nacos-discovery包名層級問題解決
問題
Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfiguration required a bean of type 'com.netflix.client.config.IClientConfig' that could not be found.
使用 com 包名層級運行
運行結(jié)果:
2021-01-07 11:17:09.441 INFO 3848 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.12.RELEASE)
2021-01-07 11:17:10.294 INFO 3848 --- [ restartedMain] com.OrderNacosMain83 : No active profile set, falling back to default profiles: default
2021-01-07 11:17:13.128 WARN 3848 --- [ restartedMain] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'nacos-discovery' contains invalid characters, please migrate to a valid format.
2021-01-07 11:17:13.430 WARN 3848 --- [ restartedMain] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2021-01-07 11:17:13.688 INFO 3848 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory id=17c50fdc-ef7b-36a2-a80c-63c33ed55773
2021-01-07 11:17:14.573 INFO 3848 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 83 (http)
2021-01-07 11:17:14.591 INFO 3848 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-01-07 11:17:14.591 INFO 3848 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.41]
2021-01-07 11:17:14.772 INFO 3848 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-01-07 11:17:14.773 INFO 3848 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4452 ms
2021-01-07 11:17:15.216 WARN 3848 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'ribbonServerList' defined in class path resource [com/alibaba/cloud/nacos/ribbon/NacosRibbonClientConfiguration.class]: Unsatisfied dependency expressed through method 'ribbonServerList' parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.netflix.client.config.IClientConfig' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
2021-01-07 11:17:15.220 INFO 3848 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-01-07 11:17:15.245 INFO 3848 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-01-07 11:17:15.577 ERROR 3848 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Parameter 0 of method ribbonServerList in com.alibaba.cloud.nacos.ribbon.NacosRibbonClientConfiguration 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.
使用 com.xxx 包名層級運行
運行結(jié)果:
2021-01-07 11:17:09.441 INFO 3848 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor
: Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.12.RELEASE)2021-01-07 11:17:10.294 INFO 3848 --- [ restartedMain] com.OrderNacosMain83 : No active profile set, falling back to default profiles: default
2021-01-07 11:17:13.128 WARN 3848 --- [ restartedMain] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'nacos-discovery' contains invalid characters, please migrate to a valid format.
2021-01-07 11:17:13.430 WARN 3848 --- [ restartedMain] o.s.boot.actuate.endpoint.EndpointId : Endpoint ID 'service-registry' contains invalid characters, please migrate to a valid format.
2021-01-07 11:17:13.688 INFO 3848 --- [ restartedMain] o.s.cloud.context.scope.GenericScope : BeanFactory
解決辦法
使用多層級包名來運行項目
此項目使用版本
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com</groupId> <artifactId>stu-alibaba</artifactId> <packaging>pom</packaging> <version>1.0-SNAPSHOT</version> <properties> <maven.compiler.source>15</maven.compiler.source> <maven.compiler.target>15</maven.compiler.target> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <spring-cloud.version>Hoxton.SR8</spring-cloud.version> <spring-boot.version>2.2.12.RELEASE</spring-boot.version> <spring-cloud-alibaba.version>2.2.3.RELEASE</spring-cloud-alibaba.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>${spring-cloud.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-dependencies</artifactId> <version>${spring-boot.version}</version> <type>pom</type> <scope>import</scope> </dependency> <dependency> <groupId>com.alibaba.cloud</groupId> <artifactId>spring-cloud-alibaba-dependencies</artifactId> <version>${spring-cloud-alibaba.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.4.0</version> </plugin> </plugins> </build> </project>
以上就是nacos-discovery包名層級問題解決的詳細內(nèi)容,更多關(guān)于nacos discovery包名層級的資料請關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
Spring Boot與Kotlin處理Web表單提交的方法
本篇文章主要介紹了Spring Boot 與 Kotlin 處理Web表單提交的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-01-01解決@NonNull @org.jetbrains.annotations.NotNull報紅的問題
這篇文章主要介紹了解決@NonNull @org.jetbrains.annotations.NotNull報紅的問題,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教2023-01-01Spring boot詳解緩存redis實現(xiàn)定時過期方法
本篇文章分享的就是spring boot中的一個輪子,spring cache注解的方式實現(xiàn)接口數(shù)據(jù)緩存。默認(rèn)的配置想非常簡單,但是有一個弊端是緩存數(shù)據(jù)為永久緩存,本次將介紹如何設(shè)置接口緩存數(shù)據(jù)的過期時間2022-07-07Java中BigInteger類的使用方法詳解(全網(wǎng)最新)
這篇文章主要介紹了Java中BigInteger類的使用方法詳解,常用最全系列,本章作為筆記使用,內(nèi)容比較全面,但常用的只有:構(gòu)造函數(shù),基本運算以及compareTo(),intValue(),setBit(),testBit()方法,需要的朋友可以參考下2023-05-05java進階解析Springboot上傳excel存入數(shù)據(jù)庫步驟
項目需要,寫了一個,批量導(dǎo)入的接口。因為需要使用excel去批量導(dǎo)入數(shù)據(jù),所以寫了一個例子,經(jīng)過測試已經(jīng)可以用于實際開發(fā),這里記錄一下2021-09-09clickhouse?批量插入數(shù)據(jù)及ClickHouse常用命令詳解
這篇文章主要介紹了clickhouse?批量插入數(shù)據(jù)及ClickHouse常用命令,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2022-03-03java去除集合中重復(fù)元素示例分享 java去除重復(fù)
這篇文章主要介紹了java去除集合中重復(fù)元素示例,大家參考使用吧2014-01-01