Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the main points for attention in SpringBoot2.0 migration

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

Editor to share with you what are the main points for attention in SpringBoot2.0 migration, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Spring's official Spring Boot 2 change guide is mainly to help you migrate your applications to Spring Boot 2.0. the changes are still in many details. The main points of the excerpt are as follows:

Spring Boot 2.0 requires Java 8 or later. Java 6 and 7 are no longer supported. It also requires Spring Framework 5.0. many configuration properties have been renamed / deleted, and developers need to update their application.properties/ application.yml accordingly. To help you, Spring Boot provides a new spring-boot-properties-migrator module. Once added as a dependency of the project, this not only analyzes the application's environment and prints diagnostics at startup, but also temporarily migrates properties for you at run time. This is a feature that you must have during application migration:

Org.springframework.boot spring-boot-properties-migrator runtime

Spring Boot now uses the CGLIB proxy by default, including AOP support. If you need an interface-based proxy, you need to set spring.aop.proxy-target-class to false

A new activity ApplicationStartedEvent has been added. ApplicationStartedEvent is sent after the context is refreshed but before any application and command line are called to run the program. ApplicationReadyEvent is sent after calling any application and command line to run the program. It indicates that the application is ready to service the request.

Spring Boot 2 uses Thymeleaf 3

In 2. 0, we set the Jackson configuration by default to write the JSR-310 date as an ISO-8601 string. If you want to return to the previous behavior, you can add spring.jackson.serialization.write-dates-as-timestamps=true to the configuration

Spring Boot 2 greatly simplifies the default security configuration, making it easy to add custom security.

Security autoconfiguration no longer exposes options and uses Spring Security default values whenever possible.

Spring Boot 2 provides OAuth 2.0 client support through Spring Security 5

Actuator no longer has a separate security autoconfiguration (the management.security.* property disappears)

Spring Data Kay renames many CRUD repository methods. The application code that calls the rename method must be updated. To simplify the migration, you may need to consider using a custom CrudRepositor subinterface to declare a default method that does not recommend using the old name and delegate to the equivalent new naming method.

The default connection pool has been switched from Tomcat to HikariCP.

DataSource now enables basic initialization only for embedded data sources and shuts down immediately when using the production database. The new spring.datasource.initialization-mode (replacing spring.datasource.initialize) provides more control.

This spring.jpa.hibernate.ddl-auto property create-drop uses an embedded database by default only if a schema manager such as Liquibase or Flyway is not used. Once the schema manager is detected, the default value is changed to none.

Elasticsearch has been upgraded to 5.4 +

Regular HazelcastInstance and dedicated HazelcastInstance caches can no longer be automatically configured.

Add: problems encountered in Spring Boot 2.0 migration

The method 1.findOne () cannot be found.

@ RequestMapping (value = "/ find") public User find (long id) {return userRepository.findOne (id);}

Change it to findById (id) .get () after 2.0to query.

@ RequestMapping (value = "/ find") public User find (long id) {return userRepository.findById (id). Get ();} above is all the content of the article "what are the main points for attention in SpringBoot2.0 migration?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report