spring云配置服务器未连接到github

5vf7fwbs  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(213)

spring云配置服务器没有从github读取数据。我已经做了好几天了。我正在尝试为microservices应用程序设置一个集中式配置系统。从那以后一直在失败。我使用的是SpringBoot2.4.5
这是云配置服务器属性

server.port=8888
spring.cloud.config.server.git.uri=https://github.com/username/environment-variable-repo.git
spring.cloud.config.server.git.uri.force-pull=true
spring.cloud.config.server.git.uri.skip-ssl-validation=true
spring.cloud.config.server.git.uri.timeout=4
spring.cloud.config.server.git.uri.username=username
spring.cloud.config.server.git.uri.password=password
spring.cloud.config.server.git.clone-on-start=true
spring.cloud.config.server.git.default-label=main
spring.cloud.config.server.enabled=true
health.config.enabled=false
spring.application.name=christdoes-spring-cloud-config-server

这是调用服务器bootstrap.properties的云客户端

spring.application.name=christdoes-cloud-client-config
spring.config.import=optional:configserver:http://localhost:8888/

这是配置客户端的application.properties

server.port=8100
management.endpoints.web.exposure.include=*

配置客户端上有2个错误:1。它在启动时使用端口8080,而配置的端口是8100。它不会从服务器中提取github配置,尽管它主动连接到服务器。我肯定是因为服务器没有从github中提取记录。当我使用postman查询服务器上的记录时,它显示它没有拉github记录。
使用 Postman 调用url配置服务器响应

http://localhost:8888/christdoes-spring-cloud-config-server/default
{
    "name": "christdoes-spring-cloud-config-server",
    "profiles": [
        "default"
    ],
    "label": null,
    "version": "767df57a6b7d852e773fe13d417cb5ae08995b12",
    "state": null,
    "propertySources": []
}

这是来自客户端的日志,显示它没有看到来自github的属性。

2021-04-18 16:59:25.077  INFO 2254 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : Fetching config from server at : http://localhost:8888
2021-04-18 16:59:25.867  INFO 2254 --- [  restartedMain] c.c.c.ConfigServicePropertySourceLocator : Located environment: name=application, profiles=[default], label=null, version=767df57a6b7d852e773fe13d417cb5ae08995b12, state=null
2021-04-18 16:59:25.867  INFO 2254 --- [  restartedMain] b.c.PropertySourceBootstrapConfiguration : Located property source: [BootstrapPropertySource {name='bootstrapProperties-configClient'}]
2021-04-18 16:59:25.874  INFO 2254 --- [  restartedMain] c.ChristdoesCloudClientConfigApplication : No active profile set, falling back to default profiles: default
2021-04-18 16:59:26.472  INFO 2254 --- [  restartedMain] o.s.cloud.context.scope.GenericScope     : BeanFactory id=87146a27-1e3d-3ffb-a882-da3f9f232877
2021-04-18 16:59:26.897  INFO 2254 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2021-04-18 16:59:26.915  INFO 2254 --- [  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2021-04-18 16:59:26.915  INFO 2254 --- [  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.45]
2021-04-18 16:59:26.997  INFO 2254 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2021-04-18 16:59:26.997  INFO 2254 --- [  restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1103 ms
2021-04-18 16:59:27.175  INFO 2254 --- [  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
2021-04-18 16:59:27.334  INFO 2254 --- [  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
2021-04-18 16:59:27.408  INFO 2254 --- [  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 8080 (http) with context path ''
2021-04-18 16:59:27.423  INFO 2254 --- [  restartedMain] c.ChristdoesCloudClientConfigApplication : Started ChristdoesCloudClientConfigApplication in 3.421 seconds (JVM running for 4.149)

从该记录中,它显示另一个名为的服务器的记录,而不是使用配置服务器名称 application . 我不知道这个配置是从哪里来的。请帮忙。这是我在这个问题上的第六天了。太令人沮丧了。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题