No qualifying bean of type 'org.springframework.boot.autoconfigure.http.HttpMessageConverters'
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.autoconfigure.http.HttpMessageConverters' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound(DefaultListableBeanFactory.java:1799) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1355) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.beans.factory.support.DefaultListableBeanFactory$DependencyObjectProvider.getObject(DefaultListableBeanFactory.java:1988) ~[spring-beans-5.3.20.jar:5.3.20] at org.springframework.cloud.openfeign.support.SpringEncoder.encodeWithMessageConverter(SpringEncoder.java:140) ~[spring-cloud-openfeign-core-3.1.3.jar:3.1.3] at org.springframework.cloud.openfeign.support.SpringEncoder.encode(SpringEncoder.java:134) ~[spring-cloud-openfeign-core-3.1.3.jar:3.1.3] at org.springframework.cloud.openfeign.support.PageableSpringEncoder.encode(PageableSpringEncoder.java:101) ~[spring-cloud-openfeign-core-3.1.3.jar:3.1.3] at feign.ReflectiveFeign$BuildEncodedTemplateFromArgs.resolve(ReflectiveFeign.java:396) ~[feign-core-11.8.jar:?] ... 18 more
在@SpringBootConfiguration 类中添加如下代码:
@Bean @ConditionalOnMissingBean public HttpMessageConverters messageConverters(ObjectProvider<HttpMessageConverter<?>> converters) { return new HttpMessageConverters(converters.orderedStream().collect(Collectors.toList())); }
就可以成功启动了
posted on 2022-07-08 15:50 悄悄的来,匆匆的走 阅读(3102) 评论(0) 编辑 收藏 举报