Hello everyone, I am your code farmer eldest brother – stack long.
At the beginning of June, I introduced the Spring team’s latest killer project: Spring Native. Its existence is to kill the JVM, and another ecology outside the JVM. The last part is also a simple practice, I believe that everyone has a new understanding, and you can click the link to see if you haven’t seen.
The previous version of Spring Native is 0.9.2, and only Spring Boot 2.4.5 is supported.
Spring Native recently released the latest version 0.10.0 based on Spring Boot 2.5 and GraalVM 21.1:
Spring Boot has been upgraded to Spring Boot 2.5.1, and Spring Native now supports Spring Boot 2.5. The support progress is really fast, and it is also good news for students studying Spring Native.
Spring Native 0.10.0 brings some new features, 43 bug fixes, documentation improvements, dependency upgrades, and more.
New features in Spring Native 0.10.0
1. Support Gradle plugin
Now you can support the official Gradle plugin.
New native build-tools are also available:
Github.com/graalvm/nat…
It replaces the native image-Maven-Plugin and allows you to build and test your native app using a native image compiler.
This upgrade feels a bit big, which means that the previous plugin doesn’t work and requires the new build tool plugin.
2. Support native testing
You can now run JUnit 5 unit test cases as native mirrors using mVN-PNative Test or Gradle nativeTest.
In addition, Spring Native now adds support for unit test initialization, so unit test cases written in @SpringBooTtest can also be run as Native images. Spring Boot unit tests are not clear, you can pay attention to the public number: Java Technology Stack, see the stack long tutorial.
Support for class-based proxies
As we all know, Native mirroring requires a proxy to be defined at build time. In previous versions of Spring Native, Spring Native also only supported interface-based JDK proxies, not generic class-based proxies via CGLIB. Because the Native features of Spring Native do not support bytecode generation at run time.
// Typical security use case of a class proxy now supported on native @Service public class GreetingService { public String hello() { return "Hello!" ; } @PreAuthorize("hasRole('ADMIN')") public String adminHello() { return "Goodbye!" ; }}Copy the code
However, starting with Spring Native 0.10.0, generic class based proxies are available, and class proxies can now be generated at build time via @aotProxyHint annotation. This is a big breakthrough!
Note that:
The previous @proxyHint has been renamed @jdkproxyHint to avoid confusion.
It supports security, transactions, and other generic class-based proxy mechanisms, and will also improve automatic detection of such patterns to reduce the large number of display prompts required.
conclusion
This article introduces three important core features of Spring Native 0.10.0, each of which is a blockbuster. It can be seen that Spring Native is still in rapid update iteration.
More details on the release can be found at:
Github.com/spring-proj…
Fast start Spring Native:
start.spring.io/
As shown in the figure, Spring Native is still part of the experience project, but it does not need JVM, faster performance, less resource occupancy, this is certainly the trend of the future, interested in can study, there is not clear can look at the stack long Spring Native actual practice, source code has been uploaded:
Github.com/javastacks/…
Stack long time will continue to study and share Spring Native dynamic and tutorials, public Java technology stack first time push, please continue to pay attention to oh!
Finally, feel my article to you with the harvest, move a small hand, to a look, forward, the original is not easy, long stack need your encouragement.
References:
Spring. IO/blog / 2021/0…
Github.com/spring-proj…
Copyright statement: this article is the public number “Java technology stack “original, original is not easy, reprint, quoting the content of this article please indicate the source, prohibit copying, washing manuscript, please respect, respect everyone’s labor and intellectual property rights, plagiarism will be corrected.
Recent hot articles recommended:
1.1,000+ Java interview questions and answers (the latest version of 2021)
2. Finally got the IntelliJ IDEA activation code through the open source project, how sweet!
3. Ali Mock tool officially open source, kill all the Mock tools on the market!
4.Spring Cloud 2020.0.0 is officially released, a new and disruptive version!
5. “Java Development Manual (Songshan version)” the latest release, speed download!
Feel good, don’t forget to click “like” + forward oh!