内容简介:节前没有新业务代码,正好Greenwich刚发布,于是开始为期四天的框架代码升级。之前的版本是 spring boot 1.5.10 , spring cloud Edgware.SR3Jedis → Lettuce
节前没有新业务代码,正好Greenwich刚发布,于是开始为期四天的框架代码升级。
之前的版本是 spring boot 1.5.10 , spring cloud Edgware.SR3
依赖升级
apply plugin: 'io.spring.dependency-management'
boot : spring-boot-starter-data-jpa
- delete → deleteById
-
findone → findById
这个改动确实大,返回值变成了Optional,合理是合理的,只改的真多。。
boot : spring-boot-starter-data-redis
Jedis → Lettuce
还好并没有使用它的autoconfiguration,配置上有一个小坑,Jedis的redis.timeout是表示connection timeout, 而Lettuce是表示command timeout,之前配置成0的,如果set到Lettuce的commandtimeout里面那就要抛异常了。
配置:
可以在build.gradle中加入,启动时会检查配置是否兼容
compile "org.springframework.boot:spring-boot-properties-migrator"
注意:完成迁移后需要删除
警告如上图会告知最新的配置格式
boot: spring-boot-starter-actuator
endpoint的暴露方式变化, management.endpoints.web.exposure.include = "*" 表示暴露所有endpoints,如果配置了security那么也需要在security的配置中开放访问 /actuator 路径
boot: spring-boot-starter-security
自动注入的 AuthenticationManager 可能会找不到
If you want to expose Spring Security’s AuthenticationManager as a bean, override the authenticationManagerBean method on your WebSecurityConfigurerAdapter and annotate it with @Bean .
cloud : eureka
各个项目在注册中心里面的客户端实例IP显示不正确,需要修改每个项目的
bootstarp.yml
- ${spring.cloud.client.ipAddress} → ${spring.cloud.client.ip-address}
boot: spring-boot-starter-test:
@spybean
其他问题
- 版本升级后会有deprecated的类或方法,所以要注意看console中build的warning信息
-
由于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
以上所述就是小编给大家介绍的《Spring Boot 2.1.2 & Spring Cloud Greenwich 升级记录》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 升级PHP7过程记录
- 升级vue全家桶过程记录
- JDK 8 升级 JDK 11 过程记录
- JDK 8 升级 JDK 11 过程记录
- 服务端升级 Ubuntu 20.04 LTS 记录
- Webpack 从 v4 升级至 v5 遇到问题记录
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
ActionScript 3.0 Cookbook
Joey Lott、Darron Schall、Keith Peters / Adobe Dev Library / 2006-10-11 / GBP 28.50
Well before Ajax and Microsoft's Windows Presentation Foundation hit the scene, Macromedia offered the first method for building web pages with the responsiveness and functionality of desktop programs......一起来看看 《ActionScript 3.0 Cookbook》 这本书的介绍吧!