Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
系统目录中的SpringBoot补充配置文件_Spring_Spring Boot_Datasource_External_Spring Properties - Fatal编程技术网

系统目录中的SpringBoot补充配置文件

系统目录中的SpringBoot补充配置文件,spring,spring-boot,datasource,external,spring-properties,Spring,Spring Boot,Datasource,External,Spring Properties,我需要一些帮助来使用另一个.yml文件来补充应用程序中的原始文件。然后我有一个由我(dev)填写的文件,但是一些配置(如数据库信息)应该由我们的客户机插入 应用程序中的一个(application.yml)具有常规配置,路径C:\Users\Public\datasource.yml上的另一个具有: spring: datasource: platform: postgres driverClassName: org.postgresql.Driver url: jd

我需要一些帮助来使用另一个.yml文件来补充应用程序中的原始文件。然后我有一个由我(dev)填写的文件,但是一些配置(如数据库信息)应该由我们的客户机插入

应用程序中的一个(application.yml)具有常规配置,路径C:\Users\Public\datasource.yml上的另一个具有:

spring:
  datasource:
    platform: postgres
    driverClassName: org.postgresql.Driver
    url: jdbc:postgresql://localhost:5432/mydb
    username: foo
    password: bar

以前有人这样做过吗?

在主配置类中配置以下注释

@PropertySource("classpath:datasource.yml")

我收到错误,因为对于项目目录之外的文件(例如:C:\Users\Public),扩展名必须是.properties,而不是yml。