无法将Spring Cloud Config Server连接到本地存储库窗口

时间:2020-05-15 02:23:07

标签: java spring-boot spring-cloud-config

我是Spring Cloud的新手,我的目标是连接本地git repo (Windows机器->在文件夹Z:/ Spring_boot_cloud_microservices_udemy / Projects / local-git-repo /中创建)到Spring Cloud Server。但是,当我输入其相应的URL http://localhost:8888/limit-services/default时,我正在获取eclipse的默认whitelabel错误页面,任何人都可以让我确定我的错误。 / p>

以下是创建的项目:

极限服务是微服务之一

enter image description here

以下是其对应的代码:

1] application.properties(限制服务->微服务)

spring.application.name=limit-services
server.port=8081
# custom limits to access for config properties
limit-service.minlimit=121  
# custom limits to access for config properties
limit-service.maxlimit=1  

2] application.properties(spring-cloud-config-server)

spring.application.name=spring-cloud-config-server
server.port=8888
spring.cloud.config.server.git.uri=file://Z:/Spring_boot_cloud_microservices_udemy/Projects/local-git-repo/

3] Spring Boot主类(spring-cloud-server):

@EnableConfigServername
@SpringBootApplication
public class SpringConfigCloudServerApplication {
public static void main(String[] args) {
        System.setProperty("spring.devtools.restart.enabled", "false");
        SpringApplication.run(SpringConfigCloudServerApplication.class, args);
    }

}

4]链接到Spring-cloud-server的本地git repo:

enter image description here

5]命中以下网址时捕获的日志为:http://localhost:8888/limit-services/default

2020-05-15 07:22:03.943  INFO 30412 --- [           main] c.s.s.SpringConfigCloudServerApplication : Started SpringConfigCloudServerApplication in 13.168 seconds (JVM running for 14.341)
2020-05-15 07:22:11.689  INFO 30412 --- [nio-8888-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-05-15 07:22:11.690  INFO 30412 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-05-15 07:22:11.700  INFO 30412 --- [nio-8888-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 10 ms
2020-05-15 07:22:11.953  INFO 30412 --- [nio-8888-exec-1] .c.s.e.MultipleJGitEnvironmentRepository : Cannot pull from remote null, the working tree is not clean.

1 个答案:

答案 0 :(得分:0)

在引用以下链接后:https://github.com/in28minutes/in28minutes-initiatives/tree/master/The-in28Minutes-TroubleshootingGuide-And-FAQ#debugging-problems-with-spring-cloud-config-server我能够识别我的错误,该错误是我没有将application.properties文件提交到本地存储库,因此我收到了以下日志信息消息:无法从远程null提取,工作树不干净。提交文件后,我能够获得预期的结果。