节前没有新业务代码,正好Greenwich刚发布,因而开始为期四天的框架代码升级。web
以前的版本是 spring boot 1.5.10 , spring cloud Edgware.SR3redis
apply plugin: 'io.spring.dependency-management'
这个改动确实大,返回值变成了Optional,合理是合理的,只改的真多。。spring
Jedis → Lettuceapache
还好并无使用它的autoconfiguration,配置上有一个小坑,Jedis的redis.timeout是表示connection timeout, 而Lettuce是表示command timeout,以前配置成0的,若是set到Lettuce的commandtimeout里面那就要抛异常了。bootstrap
能够在build.gradle中加入,启动时会检查配置是否兼容app
compile "org.springframework.boot:spring-boot-properties-migrator"
注意:完成迁移后须要删除框架
警告如上图会告知最新的配置格式maven
endpoint的暴露方式变化,management.endpoints.web.exposure.include = "*"
表示暴露全部endpoints,若是配置了security那么也须要在security的配置中开放访问/actuator
路径ide
自动注入的AuthenticationManager
可能会找不到spring-boot
If you want to expose Spring Security’s AuthenticationManager
as a bean, override the authenticationManagerBean
method on your WebSecurityConfigurerAdapter
and annotate it with @Bean
.
各个项目在注册中内心面的客户端实例IP显示不正确,须要修改每一个项目的
bootstarp.yml
@spybean
的会调用实际方法因为spring cloud依赖管理插件强制cuator升级到4.0.1,致使咱们使用的elestic-job不能正常工做,只能强行控制版本。
dependencyManagement { imports { mavenBom "org.springframework.cloud:spring-cloud-dependencies:${SPRING_CLOUD_VERSION}" } dependencies { dependency 'org.apache.curator:curator-framework:2.10.0' dependency 'org.apache.curator:curator-recipes:2.10.0' dependency 'org.apache.curator:curator-client:2.10.0' } }
若是启用出现error,报bean重复,首先确认是否是故意覆盖,如重写spring-boot自带的bean,如是,能够在bootstrap.yml加入
spring.main.allow-bean-definition-overriding=true
FeignClient注解增长了contextId属性
@FeignClient(value = "foo", contextId = "fooFeign")
此contextId即表示bean id,全部注入使用时须要
@Autowried FooFeign fooFeign
若是不写contextId,当多个class都是@FeignClient("foo"),即会认为是同一个bean而排除上一条所说的warning