Closed zhaijp closed 6 years ago
@enadim @ouaibsky
this is due to spring boot application that is loading the ribbon config as part of the main application context which is not how it should be. Ribbon loads for each client a specific spring context. consider always defining the RibbonClientsConfig in a distinct package hierarchy than the spring application. for your use case example: package myorg.consumer class ConsumerApplication
package myorg.ribbon class RibbonClientsConfig
It works ,Thank you very much @enadim
My springcloud environment is springcloud version : Finchley.RELEASE
First I have add dependency like this
Then create RibbonClientsConfig like this @Configuration @EnableRibbonStrictMetadataMatcher public class RibbonClientsConfig {
}
Last create start up class like this
@RibbonClients(defaultConfiguration = RibbonClientsConfig.class) @EnableDiscoveryClient @SpringBootApplication @EnableEurekaClient @EnableContextPropagation public class ConsumerApplication {
}
After finish the three setps i start up the startup class but it can not startup and the logs is
APPLICATION FAILED TO START
Description:
Parameter 0 of method strictMetadataMatcher in com.github.enadim.spring.cloud.ribbon.support.StrictMetadataMatcherConfig 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.