找不到类型 'com.netflix.client.config.IClientConfig' 的 Bean

Bean of type 'com.netflix.client.config.IClientConfig' that could not be found

我的功能区应用程序遇到问题。这是我的代码:

@SpringBootApplication
@EnableDiscoveryClient
@RestController
@RibbonClient(name= "bye", configuration=RibbonConfig.class )
public class RibbonAppApplication {
    @Autowired
    private RestTemplate restTemplate;
    public static void main(String[] args) {
        SpringApplication.run(RibbonAppApplication.class, args);
    }
    @GetMapping
    public String getService() {
        return restTemplate.getForObject("http://bye",String.class);
    }
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}

还有我的RibbonConfig.class

@Configuration
public class RibbonConfig {
    
    @Bean
    public IPing ribbonPing(IClientConfig config) {
        return new PingUrl(false,"/health");
    }
  
    @Bean
    public IRule ribbonRule(IClientConfig config) {
        return new AvailabilityFilteringRule();
    }
}

但是,我收到以下错误:

Parameter 0 of method ribbonPing in practice.zuul.zach.ribbonapp.RibbonConfig required a bean of type 'com.netflix.client.config.IClientConfig' that could not be found.

Action: Consider defining a bean of type 'com.netflix.client.config.IClientConfig' in your configuration.

有什么办法可以解决吗?

当我在 RibbonAppApplication 中添加这一行时问题解决了 class

@SpringBootApplication(scanBasePackages={"com.netflix.client.config.IClientConfig"})