開發(fā)意圖springboot+nacos搭建服務(wù)發(fā)現(xiàn)中心;
開發(fā)準(zhǔn)備:springboot-2.1.11.RELEASE, nacos-2.2.1.RELEASE,cloud-Greenwich.SR4
啟動(dòng)類
@SpringBootApplication
@EnableDiscoveryClient
public class ProvideApplication {
public static void main(String[] args) {
SpringApplication.run(ProvideApplication.class, args);
? ? }
}
報(bào)錯(cuò)信息
java.lang.IllegalStateException: Error processing condition on com.alibaba.cloud.nacos.discovery.reactive.NacosReactiveDiscoveryClientConfiguration.nacosReactiveDiscoveryClient ........
Caused by: java.lang.IllegalStateException: @ConditionalOnMissingBean did not specify a bean using type, name or annotation and the attempt to deduce the bean's type failed.......
Caused by: org.springframework.boot.autoconfigure.condition.OnBeanCondition$BeanTypeDeductionException: Failed to deduce bean type for com.alibaba.cloud.nacos.discovery.reactive.NacosReactiveDiscoveryClientConfiguration.nacosReactiveDiscoveryClient....
Caused by: java.lang.NoClassDefFoundError: org/springframework/cloud/client/discovery/ReactiveDiscoveryClient
Caused by: java.lang.ClassNotFoundException: org.springframework.cloud.client.discovery.ReactiveDiscoveryClient
解決
1、查看springboot版本太低,提升至springboot-2.3.2.RELEASE再次啟動(dòng);
? ? ?報(bào)錯(cuò)信息:java.lang.IllegalArgumentException: Could not find class [org.springframework.cloud.client.discovery.composite.reactive.ReactiveCompositeDiscoveryClientAutoConfiguration]
Caused by: java.lang.ClassNotFoundException: org.springframework.cloud.client.discovery.composite.reactive.ReactiveCompositeDiscoveryClientAutoConfiguration
2、更改cloud版本Hoxton.SR4,再次啟動(dòng)。完美啟動(dòng)
總結(jié):springboot版本低于nacos版本會(huì)出現(xiàn)異常;最終解決版本springboot-2.3.2.RELEASE, cloud-Hoxton.SR4,nacos-2.2.1.RELEASE