package com.persagy.fm.common.client; import feign.Logger; import feign.codec.Encoder; import feign.form.spring.SpringFormEncoder; import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.http.HttpMessageConverters; import org.springframework.cloud.openfeign.support.SpringEncoder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Primary; import org.springframework.context.annotation.Scope; import static org.springframework.beans.factory.config.BeanDefinition.SCOPE_PROTOTYPE; /** * feign配置类 * * @author lixing * @version V1.0 2021/3/29 8:11 下午 */ @Configuration public class FeignConfig { @Autowired private ObjectFactory messageConverters; @Bean @Primary @Scope(SCOPE_PROTOTYPE) Encoder feignFormEncoder() { return new SpringFormEncoder(new SpringEncoder(this.messageConverters)); } @Bean Logger.Level feignLevel(){ return Logger.Level.FULL; } }