POM
- 1.5
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>1.5.10.RELEASE</version><relativePath/></parent>
- 2.0
<parent><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-parent</artifactId><version>2.0.3.RELEASE</version><relativePath/></parent>
Spring Data
Some methods of Spring data are renamed:
- FindOne (ID), GetOne (ID)
- Delete (ID), Deletebyid (ID)
- Exists (ID), Existsbyid (ID)
- FindAll (IDs), Findallbyid (IDS)
Configuration
When upgrading, you can add spring-boot-properties-migrator to the POM so that you will be prompted to change the configuration at startup:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-properties-migrator</artifactId> <scope>runtime</scope></dependency>
The major changes are security (the security auto-configuration is no longer customizable,a global security auto-configuration are now pro vided) and management parts.
- Security
The configuration and management.security at the beginning of security have expired, as the following configuration is no longer supported and needs to be adjusted to the code:security:ignored: /api-docs,/swagger-resources/**,/swagger-ui.html**,/webjars/**
- Management
management:security:enabled: falseport: 8090
Modified to:
management:server:port: 8090
- DataSource
datasource:initialize: false
Modified to:
datasource:initialization-mode: never
If you use PostgreSQL, you may get an error: Method Org.postgresql.jdbc.PgConnection.createClob () is not yet implemented hibernate, you need to modify the configuration:
jpa: database-platform: org.hibernate.dialect.PostgreSQLDialect properties: hibernate: default_schema: test jdbc: lob: non_contextual_creation: true
For more parameters to adjust, see the reference document at the end of this article.
Security
Websecurityconfigureradapter
- Security.ignored
@Overridepublic void configure(WebSecurity web) throws Exception {web.ignoring().antMatchers("/api-docs", "/swagger-resources/**", "/swagger-ui.html**", "/webjars/**");}
- AuthenticationManager
If AuthenticationManager is injected into the code,@Autowiredprivate AuthenticationManager authenticationManager;
Error at startup: Field AuthenticationManager required a bean of type ' Org.springframework.security.authentication.AuthenticationManager ' that could not being Found. Please add the following code to the Websecurityconfigureradapter:
@Bean@Overridepublic AuthenticationManager authenticationManagerBean() throws Exception {return super.authenticationManagerBean();}
Actuator
The actuator access path has changed, and the word actuator ([/actuator/health],[/actuator/info]) is added to the front of the URL, which can be seen in the startup log.
Not to be continued ...
Reference documents
Spring Boot 2.0 Migration Guide
Spring Boot 2.0 Configuration Changelog
Spring Boot 2.0 new features and trends
Upgrade from Spring Boot 1.5 to 2.0