我确实配置了Spring Cloud Config Server。我的application.yml如下所示。
spring:
cloud:
config:
server:
git:
uri: ${HOME}/Desktop/configs
我对uri参数感兴趣。在文档https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_server.html中写明了指定路径,因此
spring.cloud.config.server.git.uri: file://${user.home}/config-repo
但是,在我的情况下,没有指定file://前缀,一切正常。使用file://前缀和不使用前缀有什么区别?
file://
确定它将在文件系统上显示,因此您可以放置相对路径并浏览文件系统。
classpath://
确定它将在您的服务/项目的类路径上查找。例如,当您要引荐resources
时,使用此选项会更容易
默认类型为file://
,但我建议将其作为前缀,因此在查看的地方它是明确的:)
查看https://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/resources.html的更多信息