1.Feign调用报错
升级Spring Boot 2.1.0 Spring Cloud Greenwich.M1 版本后,在2个Feign接口类内定义相同的名字, @FeignClient(name = 相同的名字 就会出现报错,在之前的版本不会提示报错,报错内容为The bean 'XXX.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.
解决:
在application.yml中配置:
spring:
main:
allow-bean-definition-overriding: true
在SpringBoot 2.1之前,这个配置默认就是true,而在2.1做了更改。
设置为true后,因为FeignClientSpecification的原因,FeignClient注解的configuration参数会被覆盖。
或者不要分多个类
2.ResponseBodyAdvice实现全局输出时,返回值为null是不触发
解决:自定义HttpMessageConverters后解决
博客主要讲述了升级Spring Boot 2.1.0和Spring Cloud Greenwich.M1版本后出现的两个问题及解决办法。一是Feign接口类内定义相同名字会报错,可在application.yml中配置允许覆盖bean定义;二是ResponseBodyAdvice实现全局输出时返回值为null不触发,自定义HttpMessageConverters可解决。
423

被折叠的 条评论
为什么被折叠?



