直接说结论:从springboot 2.4以后,就默认不加载bootstrap配置文件了
直接就导致,无论你怎么按网上的教程去在bootstrap.properties或bootstrap.yml里面配置springcloud nacos的信息,就是无法获取配置文件
springcloud cloud alibaba使用的版本:2021.0.1.0
springboot版本:2.6.3
解决方案:
方案一:直接在启动环境里面配置下
spring.cloud.bootstrap.enabled=true
方案二:添加依赖
org.springframework.cloud
spring-cloud-starter-bootstrap
以上方案都行
贴上spring官方解释
表现:
类似如下写法,在启动时,报错
"C:\Program Files\Java\jdk1.8.0_202\bin\java.exe" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:54163,suspend=y,server=n -XX:TieredStopAtLevel=1 -noverify -Dspring.output.ansi.enabled=always -javaagent:C:\Users\yanghao\AppData\Local\JetBrains\IntelliJIdea2021.2\captureAgent\debugger-agent.jar -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_202\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_202\jre\lib\rt.jar;D:\workspace\demo\spa\service-consumer\target\classes;D:\dev_software\repository-fb\org\springframework\boot\spring-boot-starter-web.6.7\spring-boot-starter-web-2.6.7.jar;D:\dev_software\repository-fb\org\springframework\boot\spring-boot-starter-json.6.7\spring-boot-starter-json-2.6.7.jar;D:\dev_software\repository-fb\com\fasterxml\jackson\core\jackson-databind.13.1\jackson-databind-2.13.1.jar;D:\dev_software\repository-fb\com\fasterxml\jackson\core\jackson-annotations.13.1\jackson-annotations-2.13.1.jar;D:\dev_software\repository-fb\com\fasterxml\jackson\datatype\jackson-datatype-jdk8.13.1\jackson-datatype-jdk8-2.13.1.jar;D:\dev_software\repository-fb\com\fasterxml\jackson\datatype\jackson-datatype-jsr310.13.1\jackson-datatype-jsr310-2.13.1.jar;D:\dev_software\repository-fb\com\fasterxml\jackson\module\jackson-module-parameter-names.13.1\jackson-module-parameter-names-2.13.1.jar;D:\dev_software\repository-fb\org\springframework\boot\spring-boot-starter-tomcat.6.7\spring-boot-starter-tomcat-2.6.7.jar;D:\dev_software\repository-fb\org\apache\tomcat\embed\tomcat-embed-core.0.62\tomcat-embed-core-9.0.62.jar;D:\dev_software\repository-fb\org\apache\tomcat\embed\tomcat-embed-el.0.62\tomcat-embed-el-9.0.62.jar;D:\dev_software\repository-fb\org\apache\tomcat\embed\tomcat-embed-websocket.0.62\tomcat-embed-websocket-9.0.62.jar;D:\dev_software\repository-fb\org\springframework\spring-web.3.15\spring-web-5.3.15.jar;D:\dev_software\repository-fb\org\springframework\spring-beans.3.15\spring-beans-5.3.15.jar;D:\dev_software\repository-fb\org\springframework\spring-webmvc.3.15\spring-webmvc-5.3.15.jar;D:\dev_software\repository-fb\org\springframework\spring-aop.3.15\spring-aop-5.3.15.jar;D:\dev_software\repository-fb\org\springframework\spring-context.3.15\spring-context-5.3.15.jar;D:\dev_software\repository-fb\org\springframework\spring-expression.3.15\spring-expression-5.3.15.jar;D:\dev_software\repository-fb\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-discovery21.0.1.0\spring-cloud-starter-alibaba-nacos-discovery-2021.0.1.0.jar;D:\dev_software\repository-fb\com\alibaba\cloud\spring-cloud-alibaba-commons21.0.1.0\spring-cloud-alibaba-commons-2021.0.1.0.jar;D:\dev_software\repository-fb\com\alibaba\nacos\nacos-client.4.2\nacos-client-1.4.2.jar;D:\dev_software\repository-fb\com\alibaba\nacos\nacos-common.4.2\nacos-common-1.4.2.jar;D:\dev_software\repository-fb\commons-io\commons-io.7\commons-io-2.7.jar;D:\dev_software\repository-fb\org\apache\httpcomponents\httpasyncclient.1.5\httpasyncclient-4.1.5.jar;D:\dev_software\repository-fb\org\apache\httpcomponents\httpcore.4.15\httpcore-4.4.15.jar;D:\dev_software\repository-fb\org\apache\httpcomponents\httpcore-nio.4.15\httpcore-nio-4.4.15.jar;D:\dev_software\repository-fb\org\apache\httpcomponents\httpclient.5.13\httpclient-4.5.13.jar;D:\dev_software\repository-fb\com\alibaba\nacos\nacos-api.4.2\nacos-api-1.4.2.jar;D:\dev_software\repository-fb\com\google\guava\guava.1-jre\guava-30.1-jre.jar;D:\dev_software\repository-fb\com\google\guava\failureaccess.0.1\failureaccess-1.0.1.jar;D:\dev_software\repository-fb\com\google\guava\listenablefuture99.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;D:\dev_software\repository-fb\com\google\code\findbugs\jsr305.0.2\jsr305-3.0.2.jar;D:\dev_software\repository-fb\org\checkerframework\checker-qual.5.0\checker-qual-3.5.0.jar;D:\dev_software\repository-fb\com\google\errorprone\error_prone_annotations.3.4\error_prone_annotations-2.3.4.jar;D:\dev_software\repository-fb\com\google\j2objc\j2objc-annotations.3\j2objc-annotations-1.3.jar;D:\dev_software\repository-fb\commons-codec\commons-codec.15\commons-codec-1.15.jar;D:\dev_software\repository-fb\com\fasterxml\jackson\core\jackson-core.13.1\jackson-core-2.13.1.jar;D:\dev_software\repository-fb\io\prometheus\simpleclient.12.0\simpleclient-0.12.0.jar;D:\dev_software\repository-fb\io\prometheus\simpleclient_tracer_otel.12.0\simpleclient_tracer_otel-0.12.0.jar;D:\dev_software\repository-fb\io\prometheus\simpleclient_tracer_common.12.0\simpleclient_tracer_common-0.12.0.jar;D:\dev_software\repository-fb\io\prometheus\simpleclient_tracer_otel_agent.12.0\simpleclient_tracer_otel_agent-0.12.0.jar;D:\dev_software\repository-fb\com\alibaba\spring\spring-context-support.0.11\spring-context-support-1.0.11.jar;D:\dev_software\repository-fb\org\springframework\cloud\spring-cloud-commons.1.1\spring-cloud-commons-3.1.1.jar;D:\dev_software\repository-fb\org\springframework\security\spring-security-crypto.6.1\spring-security-crypto-5.6.1.jar;D:\dev_software\repository-fb\org\springframework\cloud\spring-cloud-context.1.1\spring-cloud-context-3.1.1.jar;D:\dev_software\repository-fb\org\springframework\cloud\spring-cloud-starter-loadbalancer.1.1\spring-cloud-starter-loadbalancer-3.1.1.jar;D:\dev_software\repository-fb\org\springframework\cloud\spring-cloud-starter.1.1\spring-cloud-starter-3.1.1.jar;D:\dev_software\repository-fb\org\springframework\security\spring-security-rsa.0.10.RELEASE\spring-security-rsa-1.0.10.RELEASE.jar;D:\dev_software\repository-fb\org\bouncycastle\bcpkix-jdk15on.68\bcpkix-jdk15on-1.68.jar;D:\dev_software\repository-fb\org\bouncycastle\bcprov-jdk15on.68\bcprov-jdk15on-1.68.jar;D:\dev_software\repository-fb\org\springframework\cloud\spring-cloud-loadbalancer.1.1\spring-cloud-loadbalancer-3.1.1.jar;D:\dev_software\repository-fb\io\projectreactor\reactor-core.4.14\reactor-core-3.4.14.jar;D:\dev_software\repository-fb\org\reactivestreams\reactive-streams.0.3\reactive-streams-1.0.3.jar;D:\dev_software\repository-fb\io\projectreactor\addons\reactor-extra.4.6\reactor-extra-3.4.6.jar;D:\dev_software\repository-fb\org\springframework\boot\spring-boot-starter-cache.6.7\spring-boot-starter-cache-2.6.7.jar;D:\dev_software\repository-fb\org\springframework\spring-context-support.3.15\spring-context-support-5.3.15.jar;D:\dev_software\repository-fb\com\stoyanr\evictor.0.0\evictor-1.0.0.jar;D:\dev_software\repository-fb\com\alibaba\cloud\spring-cloud-starter-alibaba-nacos-config21.0.1.0\spring-cloud-starter-alibaba-nacos-config-2021.0.1.0.jar;D:\dev_software\repository-fb\org\slf4j\slf4j-api.7.36\slf4j-api-1.7.36.jar;D:\dev_software\repository-fb\org\springframework\spring-core.3.15\spring-core-5.3.15.jar;D:\dev_software\repository-fb\org\springframework\spring-jcl.3.15\spring-jcl-5.3.15.jar;D:\dev_software\repository-fb\org\springframework\boot\spring-boot-starter.6.7\spring-boot-starter-2.6.7.jar;D:\dev_software\repository-fb\org\springframework\boot\spring-boot.6.7\spring-boot-2.6.7.jar;D:\dev_software\repository-fb\org\springframework\boot\spring-boot-autoconfigure.6.7\spring-boot-autoconfigure-2.6.7.jar;D:\dev_software\repository-fb\org\springframework\boot\spring-boot-starter-logging.6.7\spring-boot-starter-logging-2.6.7.jar;D:\dev_software\repository-fb\ch\qos\logback\logback-classic.2.11\logback-classic-1.2.11.jar;D:\dev_software\repository-fb\ch\qos\logback\logback-core.2.11\logback-core-1.2.11.jar;D:\dev_software\repository-fb\org\apache\logging\log4j\log4j-to-slf4j.17.1\log4j-to-slf4j-2.17.1.jar;D:\dev_software\repository-fb\org\apache\logging\log4j\log4j-api.17.1\log4j-api-2.17.1.jar;D:\dev_software\repository-fb\org\slf4j\jul-to-slf4j.7.36\jul-to-slf4j-1.7.36.jar;D:\dev_software\repository-fb\jakarta\annotation\jakarta.annotation-api.3.5\jakarta.annotation-api-1.3.5.jar;D:\dev_software\repository-fb\org\yaml\snakeyaml.29\snakeyaml-1.29.jar;D:\Program Files\JetBrains\IntelliJ IDEA 2020.3.2\lib\idea_rt.jar" com.dm.serviceconsumer.ServiceConsumerApplication
Connected to the target VM, address: '127.0.0.1:54163', transport: 'socket'
. ____ _ __ _ _
/\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.6.7)
2022-05-06 15:50:48.261 INFO 21028 --- [ main] c.d.s.ServiceConsumerApplication : Starting ServiceConsumerApplication using Java 1.8.0_202 on YANGHAO with PID 21028 (D:\workspace\demo\spa\service-consumer\target\classes started by yanghao in D:\workspace\demo\spa)
2022-05-06 15:50:48.265 INFO 21028 --- [ main] c.d.s.ServiceConsumerApplication : No active profile set, falling back to 1 default profile: "default"
2022-05-06 15:50:48.895 INFO 21028 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=c3d3be9c-65d4-3abc-9f25-33f1f6997820
2022-05-06 15:50:49.111 INFO 21028 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8030 (http)
2022-05-06 15:50:49.119 INFO 21028 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-05-06 15:50:49.120 INFO 21028 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.62]
2022-05-06 15:50:49.277 INFO 21028 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-05-06 15:50:49.277 INFO 21028 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 973 ms
2022-05-06 15:50:50.461 WARN 21028 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. While this cache implementation is useful for development and tests, it's recommended to use Caffeine cache in production.You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath.
2022-05-06 15:50:50.683 ERROR 21028 --- [ main] c.a.cloud.nacos.discovery.NacosWatch : namingService subscribe failed, properties:NacosDiscoveryProperties{serverAddr='127.0.0.1:8848', username='nacos', password='nacos', endpoint='', namespace='public', watchDelay=30000, logName='', service='', weight=1.0, clusterName='DEFAULT', group='DEFAULT_GROUP', namingLoadCacheAtStart='false', metadata={preserved.register.source=SPRING_CLOUD}, registerEnabled=true, ip='192.168.101.57', networkInterface='', port=-1, secure=false, accessKey='', secretKey='', heartBeatInterval=null, heartBeatTimeout=null, ipDeleteTimeout=null, instanceEnabled=true, ephemeral=true, failureToleranceEnabled=false}, ipDeleteTimeout=null, failFast=true}
java.lang.IllegalArgumentException: Param 'serviceName' is illegal, serviceName is blank
at com.alibaba.nacos.api.naming.utils.NamingUtils.getGroupedName(NamingUtils.java:47) ~[nacos-api-1.4.2.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.subscribe(NacosNamingService.java:457) ~[nacos-client-1.4.2.jar:na]
at com.alibaba.cloud.nacos.discovery.NacosWatch.start(NacosWatch.java:133) ~[spring-cloud-starter-alibaba-nacos-discovery-2021.0.1.0.jar:2021.0.1.0]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) [spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor.access0(DefaultLifecycleProcessor.java:54) [spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) [spring-context-5.3.15.jar:5.3.15]
at java.lang.Iterable.forEach(Iterable.java:75) ~[na:1.8.0_202]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) [spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) [spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:935) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) ~[spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) ~[spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) ~[spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) ~[spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) ~[spring-boot-2.6.7.jar:2.6.7]
at com.dm.serviceconsumer.ServiceConsumerApplication.main(ServiceConsumerApplication.java:10) ~[classes/:na]
2022-05-06 15:50:50.701 INFO 21028 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8030 (http) with context path ''
2022-05-06 15:50:50.704 WARN 21028 --- [ main] c.a.c.n.registry.NacosServiceRegistry : No service to register for nacos client...
2022-05-06 15:50:51.087 WARN 21028 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.faceController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'user.age' in value "${user.age}"
2022-05-06 15:50:51.088 INFO 21028 --- [ main] c.a.c.n.registry.NacosServiceRegistry : De-registering from Nacos Server now...
2022-05-06 15:50:51.088 WARN 21028 --- [ main] c.a.c.n.registry.NacosServiceRegistry : No dom to de-register for nacos client...
2022-05-06 15:50:57.216 ERROR 21028 --- [ main] c.a.cloud.nacos.discovery.NacosWatch : namingService unsubscribe failed, properties:NacosDiscoveryProperties{serverAddr='127.0.0.1:8848', username='nacos', password='nacos', endpoint='', namespace='public', watchDelay=30000, logName='', service='', weight=1.0, clusterName='DEFAULT', group='DEFAULT_GROUP', namingLoadCacheAtStart='false', metadata={preserved.register.source=SPRING_CLOUD}, registerEnabled=true, ip='192.168.101.57', networkInterface='', port=8030, secure=false, accessKey='', secretKey='', heartBeatInterval=null, heartBeatTimeout=null, ipDeleteTimeout=null, instanceEnabled=true, ephemeral=true, failureToleranceEnabled=false}, ipDeleteTimeout=null, failFast=true}
java.lang.IllegalArgumentException: Param 'serviceName' is illegal, serviceName is blank
at com.alibaba.nacos.api.naming.utils.NamingUtils.getGroupedName(NamingUtils.java:47) ~[nacos-api-1.4.2.jar:na]
at com.alibaba.nacos.client.naming.NacosNamingService.unsubscribe(NacosNamingService.java:479) ~[nacos-client-1.4.2.jar:na]
at com.alibaba.cloud.nacos.discovery.NacosWatch.stop(NacosWatch.java:176) [spring-cloud-starter-alibaba-nacos-discovery-2021.0.1.0.jar:2021.0.1.0]
at com.alibaba.cloud.nacos.discovery.NacosWatch.destroy(NacosWatch.java:206) [spring-cloud-starter-alibaba-nacos-discovery-2021.0.1.0.jar:2021.0.1.0]
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:212) [spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:587) [spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:559) [spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:1161) [spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:520) [spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:1154) [spring-beans-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1106) [spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:596) [spring-context-5.3.15.jar:5.3.15]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) [spring-boot-2.6.7.jar:2.6.7]
at com.dm.serviceconsumer.ServiceConsumerApplication.main(ServiceConsumerApplication.java:10) [classes/:na]
2022-05-06 15:50:57.504 INFO 21028 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-05-06 15:50:57.520 INFO 21028 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-05-06 15:50:57.549 ERROR 21028 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.faceController': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'user.age' in value "${user.age}"
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1431) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:619) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:542) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean(AbstractBeanFactory.java:374) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:376) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:179) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:371) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1154) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.cloud.context.scope.refresh.RefreshScope.eagerlyInitialize(RefreshScope.java:125) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.cloud.context.scope.refresh.RefreshScope.start(RefreshScope.java:117) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.cloud.context.scope.refresh.RefreshScope.onApplicationEvent(RefreshScope.java:112) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.cloud.context.scope.refresh.RefreshScope.onApplicationEvent(RefreshScope.java:67) ~[spring-cloud-context-3.1.1.jar:3.1.1]
at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:176) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:169) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:143) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:421) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:938) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:586) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312) [spring-boot-2.6.7.jar:2.6.7]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301) [spring-boot-2.6.7.jar:2.6.7]
at com.dm.serviceconsumer.ServiceConsumerApplication.main(ServiceConsumerApplication.java:10) [classes/:na]
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'user.age' in value "${user.age}"
at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) ~[spring-core-5.3.15.jar:5.3.15]
at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-5.3.15.jar:5.3.15]
at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.3.15.jar:5.3.15]
at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.3.15.jar:5.3.15]
at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1330) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1309) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:656) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:639) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.15.jar:5.3.15]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.15.jar:5.3.15]
... 27 common frames omitted
2022-05-06 15:50:57.551 WARN 21028 --- [ Thread-6] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Start destroying common HttpClient
2022-05-06 15:50:57.551 WARN 21028 --- [ Thread-17] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Start destroying Publisher
2022-05-06 15:50:57.551 WARN 21028 --- [ Thread-17] c.a.nacos.common.notify.NotifyCenter : [NotifyCenter] Destruction of the end
2022-05-06 15:50:57.551 WARN 21028 --- [ Thread-6] c.a.n.common.http.HttpClientBeanHolder : [HttpClientBeanHolder] Destruction of the end
Disconnected from the target VM, address: '127.0.0.1:54163', transport: 'socket'
Process finished with exit code 1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)