New features of springboot3.0

Complete interpretation of the new features of springboot3.0

It turned out that the classes in the javax package were moved to the jakarta package. If it is an older version of springboot, the official suggestion is to upgrade to 2.7 first, and then upgrade to 3.0 after confirming that there is no problem. Springboot adds some automatic configurations on the basis of spring. Therefore, the spring version corresponding to springboot3.0 is 6.0, and spring6.0 is developed based on JDK17. Therefore, if you want to use springboot3.0, your corresponding JDK must be upgraded to at least 17 or above.

  1. It provides support for a local image called the Graal VM. To put it simply, it does not depend on the java virtual machine, and has better CPU utilization and memory utilization. This can start a program more quickly and elastically and smoothly.
  2. A logging framework support for log4j2. What about log4j2 and log4j? Although there is only one number difference in the name, there is a big difference in the way it is implemented in code. Compared with logback, log4j has more bugs, and log4j2 has absorbed the lessons of the previous two, which is equivalent to a redeveloped log framework. Therefore, this is also a better extended support for log4j2 in springboot3.0. Of course, these implementations all implement a log facade standard interface of sl4j. As long as your code uses a log printing performed by sl4j, then you only need to replace a jar package to achieve seamless integration.
  3. Optimized an annotation, an annotation called @ConstrutorBinding. Its main function is: it is equivalent to registering some configurations in the current context into a common bean, and the configuration can use it as an attribute. Before springboot3.0, this annotation only supported the full parameter construction method, so if our requirement is that only some parameters need to be injected, this annotation cannot support it. So the point of optimization this time is that we can define multiple construction methods, so that we can flexibly specify the constructor, so that we can use it more conveniently.

@ConstructorBinding has been moved from org.springframework.boot.context.properties to org.springframework.boot.context.properties.bind package

      4. The major feature of springboot3.0 is to improve distributed link tracking. springboot3.0 has developed a standardized solution from the official level, called Micrometer. According to the official website, it is a relatively vendor-neutral indicator interface. Micrometer adopts the design concept of a very popular monitoring system, which can monitor any java program without any dependencies. We can understand Micrometer as a set of standards or Facade. Then in actual development, we generally use Prometheus to collect an indicator data in the java process. Then use Grafana to realize a display of the Dashboard, which is equivalent to a relatively complete solution for distributed link tracking and traffic indicators.

     5. Some other minor optimizations. For example, the JDBC package allows you to perform some dynamic replacements, which gives you more flexibility and allows you to customize the content of the data source, as well as some clients such as Kafka and es, In this way, a relatively personalized trade-off can be made between performance and usability.

Guess you like

Origin blog.csdn.net/miachen520/article/details/131196705