2021/12/12 学习SpringCloud熔断器Hystrix时,遇到@SpringCloudApplication 注解 is deprecated问题
当前SpringCloud依赖版本为2020.0.4
当前SpringBoot依赖版本为2.5.7
当前Hystrix依赖为spring-cloud-starter-netflix-hystrix
,版本为2.2.10.RELEASE
@EnableCircuitBreaker
开启熔断器注解@EnableHystrix
代替。有新的代替@SpringCloudApplication
的注解,能够代替@EnableHystrix
和@EnableDiscoveryClient
和@SpringBootApplication
三者注解,直接使用的一个注解吗?
人家注释不都说了嘛,EnableDiscoveryClient自动发现已经做了优化,写不写估计都差不太多,EnableCircuitBreaker则是spring cloud默认不使用Hystrix了(原始注释是Hystrix has been removed from Spring Cloud.,被移除?)
也就是你现在想用Hystrix,就得自己写配置了,和mybatis一样,官方只提供最佳的版本依赖匹配,已经不集成到整体配置中来了