问题 feign.codec.EncodeException: 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)} 的解决方案:
Spring Cloud Gateway是基于WebFlux的,是ReactiveWeb,所以HttpMessageConverters不会自动注入。在gateway服务中配置以下Bean,即可解决。
@Bean
@ConditionalOnMissingBean
public HttpMessageConverters messageConverters(ObjectProvider<HttpMessageConverter<?>> converters) {
	return new HttpMessageConverters(converters.orderedStream().collect(Collectors.toList()));
}

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐