In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to solve the problem of spring cloud configuration center client startup, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and easy way.
Spring cloud configuration Central client starts
Start the configuration center first, and then start the client
It is found that the printed log is as follows: 2020-04-29 11 main 13 main 02.333 INFO 1856-[main] c.c.c.ConfigServicePropertySourceLocator: Fetching config from server at: http://localhost:9009/2020-04-29 11purl 138.121 INFO 1856-[main] c.c.c.ConfigServicePropertySourceLocator: Located environment: name=test-config, profiles= [dev], label=master, version=3eb2b779d066af89af4ba5b7a722d2189a15ffd3 State=null2020-04-29 1115 INFO 1856-[main] b.c.PropertySourceBootstrapConfiguration: Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties- https://github.com/kzdw/springCloudConfigCenter.git/test-config.yml (document # 1)'} BootstrapPropertySource {name='bootstrapProperties- https://github.com/kzdw/springCloudConfigCenter.git/test-config.yml (document # 0)'}] 2020-04-29 11 document 1312 INFO 1856-[main] c.z.c.ConfigCloudClientApplication: The following profiles are active: dev2020-04-29 11 11 Vera 13V 08.408 INFO 1856-[main] o.s.cloud.context.scope.GenericScope: BeanFactory id=3bad3006-6836 -326e-9ae4-7b60b788ec282020-04-29 1111 INFO 1856-[main] c.z.c.ConfigCloudClientApplication: Started ConfigCloudClientApplication in 7.436 seconds (JVM running for 8.236)
From the log, we have obtained the configuration of the configuration center, but I always feel that the log is wrong, why there is no port to start.
Springcloud often has one module containing another module. Isn't the web module included in spring-cloud-starter-config?
Then add the web module. Org.springframework.boot spring-boot-starter-web join and then start the project 2020-04-29 11 org.springframework.boot spring-boot-starter-web 35.379 INFO 10060-[main] c.c.c.ConfigServicePropertySourceLocator: Fetching config from server at: http://localhost:9009/2020-04-29 11 org.springframework.boot spring-boot-starter-web 20 INFO 36.849 INFO 10060-[main] c.c.c.ConfigServicePropertySourceLocator: Located environment: name=test-config Profiles= [dev], label=master, version=3eb2b779d066af89af4ba5b7a722d2189a15ffd3, state=null2020-04-29 1111 label=master 20 label=master 36.850 INFO 10060-[main] b.c.PropertySourceBootstrapConfiguration: Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}, BootstrapPropertySource {name='bootstrapProperties- https://github.com/kzdw/springCloudConfigCenter.git/test-config.yml (document # 1)'} BootstrapPropertySource {name='bootstrapProperties- https://github.com/kzdw/springCloudConfigCenter.git/test-config.yml (document # 0)'}] 2020-04-29 11 main 20 document 36.855 INFO 10060-[main] c.z.c.ConfigCloudClientApplication: The following profiles are active: dev2020-04-29 11 11 V 20 o.s.cloud.context.scope.GenericScope 37.278 INFO 10060-[main] o.s.cloud.context.scope.GenericScope: BeanFactory id=21eb9db3-9e16 -3c20-bd81-2c0ea23b0f122020-04-29 11 11 main 20 INFO 37.566 INFO 10060-[main] o.s.b.w.embedded.tomcat.TomcatWebServer: Tomcat initialized with port (s): 8201 (http) 2020-04-29 11 11 V 20 Starting service 37.574 INFO 10060-[main] o.apache.catalina.core.StandardService: Starting service [Tomcat] 2020-04-29 11 20 main INFO 10060-[ Main] org.apache.catalina.core.StandardEngine: Starting Servlet engine: [Apache Tomcat/9.0.33] 2020-04-29 11 Apache Tomcat/9.0.33 20 INFO 37.684 INFO 10060-[main] o.a.c.c.C. [tomcat]. [localhost]. [/]: Initializing Spring embedded WebApplicationContext2020-04-29 11 11 Starting Servlet engine 20 Starting Servlet engine 37.684 INFO 10060-[main] o.s.web.context .ContextLoader: Root WebApplicationContext: initialization completed in 817 ms2020-04-29 11 ms2020 20 INFO 37.851 INFO 10060-- [main] o.s.s.concurrent.ThreadPoolTaskExecutor: Initializing ExecutorService 'applicationTaskExecutor'2020-04-29 11 11 Visa 20 INFO 38.200 INFO 10060-[main] o.s.b.w.embedded.tomcat.TomcatWebServer: Tomcat started on port (s): 8201 (http) with context path' 2020-04-- 29 111120 INFO 38.285 INFO 10060-[main] c.z.c.ConfigCloudClientApplication: Started ConfigCloudClientApplication in 3.87 seconds (JVM running for 4.531)
Sure enough, the configuration was pulled from the configuration center and started successfully.
Spring cloud configuration central client configuration pit 1. The error message is as follows
When starting the client in the configuration center, the following error message is reported:
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'foo' in value "${foo}"
two。 Du Niang checked and found that many people ran into this pit.
First of all, I submit to the git to the configuration file name of the following two files
Cloud-config-dev.propertiescloud-config-test.properties
Follow the rules of the configuration center configuration file / {application}-{profile} .properties
So when calling cloud-config-client, applcation.name should be cloud-config, but when I configure it, I take it for granted that it is written as cloud-config-client, resulting in the above error.
The solution is simple. The configuration of posted client is as follows.
This is the answer to the question about how to solve the problems encountered in the startup of the spring cloud configuration center client. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.