Feign调用传输文件异常
- 1. Current request is not a multipart request
- 2. Feign failed and no fallback
- 3.Read timed out executing POST for "xxx"
1. Current request is not a multipart request
feign接口参数使用@RequestPart 而非@RequestParam, 同时需要指定consumes,比如这样:
@PostMapping(value="/upload",consumes= MediaType.MULTIPART_FORM_DATA_VALUE)
Result<FileStorage>upload(@RequestPart(value="file") MultipartFile file);
2. Feign failed and no fallback
这是hystrix导致,关闭feign熔断,或者延长熔断的超时时间,我简单粗暴的直接关了
3.Read timed out executing POST for “xxx”
配置了hystrix还不行,或者延长ribbon的超时时间,参考了Feign超时问题的办法,简单来说就是feign经过了ribbonn和hystrix两级调用,而且都有一个默认的超时时间,延长超时时间就好了
spring:servlet:context-path: /farmapplication:name: farmprofiles:active: devmain:allow-bean-definition-overriding:trueeureka:client:service-url:defaultZone: http://127.0.0.1:7001/eurekainstance:prefer-ip-address:true#关闭feign熔断feign:hystrix:enabled:false#开启熔断,关闭熔断超时或延长调用超时时间#hystrix:# command:# default:# execution:# timeout:# enabled: false# isolation:# thread:# timeoutInMilliseconds: 30000#延长ribbon超时时间ribbon:ReadTimeout:30000ConnectTimeout:30000
声明:本站所有文章,如无特殊说明或标注,均为网络收集发布。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。