spring-cloud feign调用异常:: TODO

时间:2025-04-03 18:10:34
@Configuration public class WebConfig extends WebMvcConfigurerAdapter { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**").allowedOrigins("*").allowedMethods("GET", "POST", "OPTIONS", "PUT") .allowedHeaders( "Content-Type", "X-Requested-With", "accept", "Origin", "Access-Control-Request-Method", "Access-Control-Request-Headers" ) .exposedHeaders("Access-Control-Allow-Origin", "Access-Control-Allow-Credentials") .allowCredentials(true).maxAge(3600); } // @Bean // public HttpMessageConverters fastJsonHttpMessageConverters() { // //1.需要定义一个Convert转换消息的对象 // FastJsonHttpMessageConverter fastConverter = new FastJsonHttpMessageConverter(); // //2.添加fastjson的配置信息,比如是否要格式化返回的json数据 // FastJsonConfig fastJsonConfig = new FastJsonConfig(); // fastJsonConfig.setSerializerFeatures(SerializerFeature.PrettyFormat); // fastJsonConfig.setCharset(Charset.forName("UTF-8")); // //3.在convert中添加配置信息 // fastConverter.setFastJsonConfig(fastJsonConfig); // // HttpMessageConverter<?> converter = fastConverter; // return new HttpMessageConverters(converter); // } }