使用file://前缀和不使用前缀有什么区别?

时间:2019-12-20 09:44:43

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

我确实配置了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://前缀和不使用前缀有什么区别?

1 个答案:

答案 0 :(得分:1)

file://确定它将在文件系统上显示,因此您可以放置​​相对路径并浏览文件系统。

classpath://确定它将在您的服务/项目的类路径上查找。例如,当您要引荐resources时更容易使用此密码

默认类型为file://,但我建议将其作为前缀,因此您在看的地方很明确:)

有关https://docs.spring.io/spring/docs/3.2.x/spring-framework-reference/html/resources.html的更多信息

相关问题