我的Spring云配置服务器没有从类路径中选取yml文件
spring:
profiles:
active: native
cloud:
config:
server:
native:
search-locations: file:///C:/Users/Arun/git/MicroService_sample/config-server/src/main/resources/application-local.yml
得到以下结果,即使我使用 search-locations: classpath:/configserver-local.yml
结果
{"name":"configserver","profiles":["local"],"label":null,"version":"d1da013b1365b9001a5609e12c8590c875d782f4","state":null,"propertySources":[]}
端点:http://localhost:8080/configserver/local
我没有找到任何在应用程序启动时选择 yml 文件的日志
最佳答案
尝试修改您的搜索位置地址
我尝试将文件放入 D 盘,其中包含 .yml,如下所示
spring:
profiles:
active: native
cloud:
config:
server:
native:
search-locations: D:/
并在 D:\configserver-local.yml 中包含内容的文件
test: 1233333
当我访问 http://localhost:8080/configserver/local 时,结果是预期的
{"name":"configserver","profiles":["local"],"label":null,"version":null,"state":null,"propertySources":[{"name":"file:D:/configserver-local.yml","source":{"test":1233333}}]}
关于java - Spring Cloud Native Config Server不选择yml文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55583784/