EurekaClient 启动报错
近期,项目组打算尝试springcloud,因此大军未动,粮草先行,个人先来趟趟水。这不,开门大吉!! 先贴上启动类代码,乍一看,没问题呀,很常见的simple-demo @EnableDiscoveryClient
近期,项目组打算尝试springcloud,因此大军未动,粮草先行,个人先来趟趟水。
这不,开门大吉!!
先贴上启动类代码,乍一看,没问题呀,很常见的simple-demo
@EnableDiscoveryClient
@SpringBootApplication
public class EurekaClient {
public static void main(String[] args) {
new SpringApplicationBuilder(EurekaClient.class)
.web(true).run(args);
}
}
接着开始启动。。。。
boom -->>
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-07-11 22:47:01.965 ERROR 19920 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 1 of method discoveryClient in org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration required a bean of type 'com.netflix.discovery.EurekaClient' that could not be found.
- Bean method 'eurekaClient' not loaded because AnyNestedCondition 0 matched 2 did not; NestedCondition on EurekaClientAutoConfiguration.OnMissingRefreshScopeCondition.MissingScope @ConditionalOnMissingBean (types: org.springframework.cloud.autoconfigure.RefreshAutoConfiguration; SearchStrategy: all) found bean 'org.springframework.cloud.autoconfigure.RefreshAutoConfiguration'; NestedCondition on EurekaClientAutoConfiguration.OnMissingRefreshScopeCondition.MissingClass @ConditionalOnMissingClass found unwanted class 'org.springframework.cloud.context.scope.refresh.RefreshScope'
Action:
Consider revisiting the conditions above or defining a bean of type 'com.netflix.discovery.EurekaClient' in your configuration.
很莫名奇妙的挂了,细看才知道 eurekaClient 是 EurekaClientAutoConfiguration类里的RefreshableEurekaClientConfiguration 内部类的一个公开方法名用来找服务的,所以启动类在加载的时候起了冲突,才导致的启动失败。
各位要以此为戒啊,命名规范很重要!!!
更多推荐
所有评论(0)