org.springframework.cloud.openfeign.support.ResponseEntityDecoder Java Examples
The following examples show how to use
org.springframework.cloud.openfeign.support.ResponseEntityDecoder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CorsConfiguration.java From zuihou-admin-cloud with Apache License 2.0 | 6 votes |
/** * 升级版本后, 不加这个 gateway 使用feign会报错,不知道什么原因 * * @return */ @Bean public Decoder feignFormDecoder() { List<HttpMessageConverter<?>> converters = new RestTemplate().getMessageConverters(); ObjectFactory<HttpMessageConverters> factory = () -> new HttpMessageConverters(converters); return new ResponseEntityDecoder(new SpringDecoder(factory)); }
Example #2
Source File: SimulatedDeviceFactory.java From hawkbit-examples with Eclipse Public License 1.0 | 6 votes |
private AbstractSimulatedDevice createDdiDevice(final String id, final String tenant, final int pollDelaySec, final URL baseEndpoint, final String gatewayToken) { final ObjectMapper mapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .registerModule(new Jackson2HalModule()); final RootControllerResourceClient controllerResource = Feign.builder() .requestInterceptor(new GatewayTokenInterceptor(gatewayToken)) .contract(new IgnoreMultipleConsumersProducersSpringMvcContract()).logLevel(Level.HEADERS) .decoder(new ResponseEntityDecoder(new JacksonDecoder(mapper))).encoder(new JacksonEncoder()) .logger(new Slf4jLogger()).decode404() .target(RootControllerResourceClient.class, baseEndpoint.toString()); return new DDISimulatedDevice(id, tenant, pollDelaySec, controllerResource, deviceUpdater, gatewayToken); }
Example #3
Source File: FeignConfig.java From XS2A-Sandbox with Apache License 2.0 | 5 votes |
@Bean public Decoder feignDecoder() { ObjectMapper objectMapper = new ObjectMapper(); objectMapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false); objectMapper.registerModule(new JavaTimeModule()); HttpMessageConverter jacksonConverter = new MappingJackson2HttpMessageConverter(objectMapper); ObjectFactory<HttpMessageConverters> objectFactory = () -> new HttpMessageConverters(jacksonConverter); return new ResponseEntityDecoder(new SpringDecoder(objectFactory)); }
Example #4
Source File: ReservationService.java From spring-cloud-in-action with MIT License | 5 votes |
@Bean public Decoder feignDecoder() { ObjectMapper objectMapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true) .registerModule(new Jackson2HalModule()); MappingJackson2HttpMessageConverter jacksonConverter = new MappingJackson2HttpMessageConverter(); jacksonConverter.setSupportedMediaTypes(Arrays.asList(MediaTypes.HAL_JSON)); jacksonConverter.setObjectMapper(objectMapper); ObjectFactory<HttpMessageConverters> objectFactory = () -> new HttpMessageConverters(jacksonConverter); return new ResponseEntityDecoder(new SpringDecoder(objectFactory)); }
Example #5
Source File: Application.java From hawkbit-examples with Eclipse Public License 1.0 | 5 votes |
private static MgmtSoftwareModuleClientResource uploadSoftwareModule( final ClientConfigurationProperties configuration) { final ObjectMapper mapper = new ObjectMapper() .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .registerModule(new Jackson2HalModule()); return Feign.builder().contract(new IgnoreMultipleConsumersProducersSpringMvcContract()).decode404() .requestInterceptor( new BasicAuthRequestInterceptor(configuration.getUsername(), configuration.getPassword())) .logger(new Slf4jLogger()).encoder(new FeignMultipartEncoder()) .decoder(new ResponseEntityDecoder(new JacksonDecoder(mapper))) .target(MgmtSoftwareModuleClientResource.class, configuration.getUrl()); }
Example #6
Source File: FeignConfig.java From gateway with GNU General Public License v3.0 | 4 votes |
@Bean public Decoder feignDecoder() { return new ResponseEntityDecoder(new SpringDecoder(feignHttpMessageConverter())); }
Example #7
Source File: OpenFeignAutoConfiguration.java From summerframework with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean public Decoder feignDecoder(List<ApiResultHandler> apiResultHandlers) { return new ApiResultDecoder(new ResponseEntityDecoder(new SpringDecoder(this.messageConverters)), apiResultHandlers); }
Example #8
Source File: FeignClientsConfiguration.java From spring-cloud-openfeign with Apache License 2.0 | 4 votes |
@Bean @ConditionalOnMissingBean public Decoder feignDecoder() { return new OptionalDecoder( new ResponseEntityDecoder(new SpringDecoder(this.messageConverters))); }
Example #9
Source File: SpringCloudConfiguration.java From ByteJTA with GNU Lesser General Public License v3.0 | 4 votes |
@org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean(feign.codec.Decoder.class) @org.springframework.context.annotation.Bean public feign.codec.Decoder feignDecoder(@Autowired ObjectFactory<HttpMessageConverters> messageConverters) { return new ResponseEntityDecoder(new SpringDecoder(messageConverters)); }