Я пытаюсь проксировать составной запрос через feign.
@PostMapping(value = "{pathUri1}/{pathUri2}",consumes = MediaType.MULTIPART_FORM_DATA_VALUE,produces = MediaType.APPLICATION_JSON_VALUE)
ResponseEntity<BaseResponse<?>> uploadFileCall(@PathVariable(value = "pathUri1") String pathUri1, @PathVariable(value = "pathUri2") String pathUri2, @RequestPart(name = "file") MultipartFile file, @RequestParam Map<Object,Object> requestParam, @RequestHeader HttpHeaders httpHeaders);
это сервисный звонок.
@Configuration
class MultipartSupportConfig {
@Autowired
ObjectFactory<HttpMessageConverters> messageConverters;
@Bean
@Primary
@Scope("prototype")
public Encoder feignFormEncoder() {
return new SpringFormEncoder(new SpringEncoder(messageConverters));
}
}
добавлена конфигурация кодировщика для multipart/form-data .
я следил за этим https://github.com/OpenFeign/feign-форма
Но я получаю hystrixRunTimeException, что вызвано из-за
java.lang.NoClassDefFoundError: симулировать/Request$Body ошибка.





Используйте версию 3.4.1 feign-form-spring.
Грейдл
compile(group: 'io.github.openfeign.form', name: 'feign-form-spring', version: '3.4.1')
Мавен
<dependency>
<groupId>io.github.openfeign.form</groupId>
<artifactId>feign-form</artifactId>
<version>3.4.1</version>
</dependency>
Проверить требования https://github.com/OpenFeign/feign-form#requirements
Согласно GitHub-документ open-feign, пожалуйста, Примечание версии фальшивой формы:
У меня работает следующий конфиг:
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-jackson</artifactId>
<version>${feign.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>io.github.openfeign</groupId>
<artifactId>feign-httpclient</artifactId>
<version>${feign.version}</version>
</dependency>
Где:
<feign.version>11.0</feign.version>
<spring-cloud.version>Хокстон.SR3</spring-cloud.version>