Spring cloud config server not loading the properties files

半腔热情 提交于 2020-01-15 07:26:09

问题


I'm trying to use this sample spring cloud config server application https://github.com/spring-cloud-samples/configserver but it is not working as expected in my local "windows 7" machine.

When I try to access http://localhost:8888/foo/development I'm getting an result as below without any properties

{
  "name": "foo",
  "profiles": [
    "development"
   ],
  "label": "master",
  "propertySources": [
  ]
}

Below are some of the logs related to the property file loading

2015-04-13 17:46:03.381 DEBUG 6684 --- [nio-8888-exec-1] o.s.c.c.s.NativeEnvironmentRepository : Not adding property source: file:/C:/Users/sekhap/git/configserver/target/config/foo-development.properties
2015-04-13 17:46:03.382 DEBUG 6684 --- [nio-8888-exec-1] o.s.c.c.s.NativeEnvironmentRepository : Not adding property source: file:/C:/Users/sekhap/git/configserver/target/config/foo.properties
2015-04-13 17:46:03.382 DEBUG 6684 --- [nio-8888-exec-1] o.s.c.c.s.NativeEnvironmentRepository : Not adding property source: file:/C:/Users/sekhap/git/configserver/target/config/application.yml

Why the properties not getting loaded? Is there any thing to do with Windows environment and because of "/" in front of the C: ?


回答1:


This is a bug in the currently released version (1.0.1.RELEASE), and has been fixed in the current snapshot (1.0.2.BUILD-SNAPSHOT).

The code that checks to see if a configuration should be included was not normalizing the file paths, so when running on Windows it failed because the file path had Windows separators ("\") and the path it compares against has linux separators ("/").



来源:https://stackoverflow.com/questions/29605520/spring-cloud-config-server-not-loading-the-properties-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!