是否可以在不使用任何 Git 存储库的情况下使用 Spring Cloud Config?我正在尝试在 application.properties 中使用本地目录对其进行测试:
spring.cloud.config.server.git.uri=file://${user.dir}/src/main/resources/config-repo
但我收到以下错误:
java.lang.IllegalStateException:文件中没有 .git://path/to/src/main/resources/config-repo
那么,如果一个人根本不使用 Git,就不可能使用 Spring Cloud 吗?
更新:
感谢 Spencer 的建议,我添加了以下内容:
spring.profiles.active=native
spring.cloud.config.server.native.searchLocations=${user.dir}/src/main/resources/configs
我在“configs”中有一个文件“bar.properties”,内容如下:
foo: bar
但是我得到的响应不是读取文件:
{
"name": "bar",
"profiles": [
"default"
],
"label": "master",
"propertySources": []
}
我使用的 URL 是http://localhost:8888/bar/default
我还缺少其他东西吗?再次提前感谢!