Skip to content

openfeign指定配置类启动报错 #162

@sanluffy

Description

@sanluffy

feignClient指定config类

//feign配置
@FeignClient(name = "dcdClient", url = "${dcd.url:}", configuration = DcdConfig.class)
public interface DcdClient {

}

//配置类
public class DcdConfig {

    @Bean("dcdRequestInterceptor")
    public DcdRequestInterceptor getRequestInterceptor() {
        return new DcdRequestInterceptor();
    }

    @Bean("dcdEncoder")
    public DcdEncoder getEncoder() {
        return new DcdEncoder();
    }

    @Bean("dcdDecoder")
    public DcdDecoder getDecoder() {
        return new DcdDecoder();
    }

    @Bean("dcdErrorDecoder")
    public DcdErrorDecoder getErrorDecoder() {
        return new DcdErrorDecoder();
    }

}


//注入SpringFormEncoder
public class DcdRequestInterceptor implements RequestInterceptor {

    @Autowired
    private SpringFormEncoder encoder;
}

报错信息

应用启动后,插件加载正常,最后提示
DcdRequestInterceptor required a bean of type 'feign.form.spring.SpringFormEncoder' that could not be found.

The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)

Action:

Consider defining a bean of type 'feign.form.spring.SpringFormEncoder' in your configuration.

版本信息

  • 插件信息:INFO [main] i.g.f.d.t.h.c.HotswapAgent 66 : open hot reload unlimited runtime class redefinition.{4.4.3}
  • springboot 版本:2.6.x
  • jdk :jbr-11

操作系统

mac os m3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions