关于SpringCloud报错Unsatisfied dependency expressed through field ‘propertySourceLocators的解决之一

时间:2025-03-18 07:45:05

这里写目录标题

    • 1. 问题简述
    • 2. 报错显示
    • 3. 问题说明

1. 问题简述

今天给大家看一下,关于SpringCloud报错Unsatisfied dependency expressed through field ‘propertySourceLocators’ 的描述,这里只是其中一个报错 。这里也有一个很明显的报错:Application failed to connect to Nacos server: “nacos:8848”。就是说你办法连接到nacos 的配置。报的错误有点多,你想看结论请看第三部分。

2. 报错显示

Application failed to connect to Nacos server: "nacos:8848"

Action:

Please check your Nacos server config

2022-06-26 14:35:07.007 ERROR 12408 --- [           main]                : Application run failed

: Error creating bean with name '': Unsatisfied dependency expressed through field 'propertySourceLocators'; nested exception is : Error creating bean with name 'nacosPropertySourceLocator' defined in class path resource [com/alibaba/cloud/nacos/]: Unsatisfied dependency expressed through method 'nacosPropertySourceLocator' parameter 0; nested exception is : Error creating bean with name 'nacosConfigManager' defined in class path resource [com/alibaba/cloud/nacos/]: Bean instantiation via factory method failed; nested exception is : Failed to instantiate []: Factory method 'nacosConfigManager' threw exception; nested exception is : 
	at $AutowiredFieldElement.resolveFieldValue(:660) ~[spring-beans-5.2.:5.2.]
	at $AutowiredFieldElement.inject(:640) ~[spring-beans-5.2.:5.2.]
	at (:119) ~[spring-beans-5.2.:5.2.]
	at (:399) ~[spring-beans-5.2.:5.2.]
	at (:1425) ~[spring-beans-5.2.:5.2.]
	at (:593) ~[spring-beans-5.2.:5.2.]
	at (:516) ~[spring-beans-5.2.:5.2.]
	at $doGetBean$0(:324) ~[spring-beans-5.2.:5.2.]
	at (:234) ~[spring-beans-5.2.:5.2.]
	at (:322) ~[spring-beans-5.2.:5.2.]
	at (:202) ~[spring-beans-5.2.:5.2.]
	at (:897) ~[spring-beans-5.2.:5.2.]
	at (:879) ~[spring-context-5.2.:5.2.]
	at (:551) ~[spring-context-5.2.:5.2.]
	at (:758) [spring-boot-2.3.:2.3.]
	at (:750) [spring-boot-2.3.:2.3.]
	at (:405) [spring-boot-2.3.:2.3.]
	at (:315) [spring-boot-2.3.:2.3.]
	at (:140) ~[spring-boot-2.3.:2.3.]
	at (:212) ~[spring-cloud-context-2.2.:2.2.]
	at (:117) ~[spring-cloud-context-2.2.:2.2.]
	at (:74) ~[spring-cloud-context-2.2.:2.2.]
	at (:172) ~[spring-context-5.2.:5.2.]
	at (:165) ~[spring-context-5.2.:5.2.]
	at (:139) ~[spring-context-5.2.:5.2.]
	at (:127) ~[spring-context-5.2.:5.2.]
	at (:80) ~[spring-boot-2.3.:2.3.]
	at (:53) ~[spring-boot-2.3.:2.3.]
	at (:345) [spring-boot-2.3.:2.3.]
	at (:308) [spring-boot-2.3.:2.3.]
	at (:1237) [spring-boot-2.3.:2.3.]
	at (:1226) [spring-boot-2.3.:2.3.]
	at (:11) [classes/:na]
Caused by: : Error creating bean with name 'nacosPropertySourceLocator' defined in class path resource [com/alibaba/cloud/nacos/]: Unsatisfied dependency expressed through method 'nacosPropertySourceLocator' parameter 0; nested exception is : Error creating bean with name 'nacosConfigManager' defined in class path resource [com/alibaba/cloud/nacos/]: Bean instantiation via factory method failed; nested exception is : Failed to instantiate []: Factory method 'nacosConfigManager' threw exception; nested exception is : 
	at (:799) ~[spring-beans-5.2.:5.2.]
	at (:540) ~[spring-beans-5.2.:5.2.]
	at (:1341) ~[spring-beans-5.2.:5.2.]
	at (:1181) ~[spring-beans-5.2.:5.2.]
	at (:556) ~[spring-beans-5.2.:5.2.]
	at (:516) ~[spring-beans-5.2.:5.2.]
	at $doGetBean$0(:324) ~[spring-beans-5.2.:5.2.]
	at (:234) ~[spring-beans-5.2.:5.2.]
	at (:322) ~[spring-beans-5.2.:5.2.]
	at (:202) ~[spring-beans-5.2.:5.2.]
	at (:276) ~[spring-beans-5.2.:5.2.]
	at (:1525) ~[spring-beans-5.2.:5.2.]
	at (:1489) ~[spring-beans-5.2.:5.2.]
	at (:1378) ~[spring-beans-5.2.:5.2.]
	at (:1265) ~[spring-beans-5.2.:5.2.]
	at (:1227) ~[spring-beans-5.2.:5.2.]
	at $AutowiredFieldElement.resolveFieldValue(:657) ~[spring-beans-5.2.:5.2.]
	... 32 common frames omitted
Caused by: : Error creating bean with name 'nacosConfigManager' defined in class path resource [com/alibaba/cloud/nacos/]: Bean instantiation via factory method failed; nested exception is : Failed to instantiate []: Factory method 'nacosConfigManager' threw exception; nested exception is : 
	at (:657) ~[spring-beans-5.2.:5.2.]
	at (:637) ~[spring-beans-5.2.:5.2.]
	at (:1341) ~[spring-beans-5.2.:5.2.]
	at (:1181) ~[spring-beans-5.2.:5.2.]
	at (:556) ~[spring-beans-5.2.:5.2.]
	at (:516) ~[spring-beans-5.2.:5.2.]
	at $doGetBean$0(:324) ~[spring-beans-5.2.:5.2.]
	at (:234) ~[spring-beans-5.2.:5.2.]
	at (:322) ~[spring-beans-5.2.:5.2.]
	at (:202) ~[spring-beans-5.2.:5.2.]
	at (:276) ~[spring-beans-5.2.:5.2.]
	at (:1307) ~[spring-beans-5.2.:5.2.]
	at (:1227) ~[spring-beans-5.2.:5.2.]
	at (:886) ~[spring-beans-5.2.:5.2.]
	at (:790) ~[spring-beans-5.2.:5.2.]
	... 48 common frames omitted
Caused by: : Failed to instantiate []: Factory method 'nacosConfigManager' threw exception; nested exception is : 
	at (:185) ~[spring-beans-5.2.:5.2.]
	at (:652) ~[spring-beans-5.2.:5.2.]
	... 62 common frames omitted
Caused by: : 
	at (:62) ~[spring-cloud-starter-alibaba-nacos-config-2.2.:2.2.]
	at .<init>(:43) ~[spring-cloud-starter-alibaba-nacos-config-2.2.:2.2.]
	at (:43) ~[spring-cloud-starter-alibaba-nacos-config-2.2.:2.2.]
	at .invoke0(Native Method) ~[na:1.8.0_161]
	at (:62) ~[na:1.8.0_161]
	at (:43) ~[na:1.8.0_161]
	at (:498) ~[na:1.8.0_161]
	at (:154) ~[spring-beans-5.2.:5.2.]
	... 63 common frames omitted
Caused by: : 
	at (:46) ~[nacos-api-1.4.:na]
	at (:44) ~[nacos-api-1.4.:na]
	at (:55) ~[spring-cloud-starter-alibaba-nacos-config-2.2.:2.2.]
	... 70 common frames omitted
Caused by: : null
	at .newInstance0(Native Method) ~[na:1.8.0_161]
	at (:62) ~[na:1.8.0_161]
	at (:45) ~[na:1.8.0_161]
	at (:423) ~[na:1.8.0_161]
	at (:43) ~[nacos-api-1.4.:na]
	... 72 common frames omitted
Caused by: : The IPv4 address("nacos") is incorrect.
	at (:152) ~[nacos-common-1.4.:na]
	at .<init>(:162) ~[nacos-client-1.4.:na]
	at .<init>(:274) ~[nacos-client-1.4.:na]
	at .<init>(:86) ~[nacos-client-1.4.:na]
	... 77 common frames omitted

2022-06-26 14:35:07.007  WARN 12408 --- [       Thread-5]    : [HttpClientBeanHolder] Start destroying common HttpClient
2022-06-26 14:35:07.007  WARN 12408 --- [       Thread-5]    : [HttpClientBeanHolder] Destruction of the end

3. 问题说明

这里其实就是一个很小的错误,就是你端口号可能写错了,你看看你的端口号,我是检查到了自己的端口写错了。希望能帮到你。