标签:uid htm exist info 参考 hue could not 重命名 tom
POM<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath/>
</parent>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath/>
</parent>
Spring Data的一些方法进行了重命名:
在升级时,可以在pom中增加spring-boot-properties-migrator,这样在启动时会提示需要更改的配置:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-properties-migrator</artifactId>
<scope>runtime</scope>
</dependency>
其中改动较大的是security(The security auto-configuration is no longer customizable,A global security auto-configuration is now provided)和management部分。
security:
ignored: /api-docs,/swagger-resources/**,/swagger-ui.html**,/webjars/**
management:
security:
enabled: false
port: 8090
修改为:
management:
server:
port: 8090
datasource:
initialize: false
修改为:
datasource:
initialization-mode: never
如使用PostgreSQL,可能会报错:Method org.postgresql.jdbc.PgConnection.createClob() is not yet implemented hibernate,需修改配置:
jpa:
database-platform: org.hibernate.dialect.PostgreSQLDialect
properties:
hibernate:
default_schema: test
jdbc:
lob:
non_contextual_creation: true
更多需要调整的参数请看文末参考文档。
WebSecurityConfigurerAdapter
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers("/api-docs", "/swagger-resources/**", "/swagger-ui.html**", "/webjars/**");
}
@Autowired
private AuthenticationManager authenticationManager;
在启动时会报错:Field authenticationManager required a bean of type ‘org.springframework.security.authentication.AuthenticationManager‘ that could not be found.请在WebSecurityConfigurerAdapter中增加以下代码:
@Bean
@Override
public AuthenticationManager authenticationManagerBean() throws Exception {
return super.authenticationManagerBean();
}
Actuator访问路径发生了变化,网址前部增加了单词actuator([/actuator/health],[/actuator/info]),这可以在启动日志中看到。
未完待续...
Spring Boot 2.0 Migration Guide
Spring Boot 2.0 Configuration Changelog
Spring Boot 2.0 新特性和发展方向
标签:uid htm exist info 参考 hue could not 重命名 tom
原文地址:http://blog.51cto.com/7308310/2133163