spring boot无法读取正确的属性文件

时间:2018-03-31 04:10:05

标签: spring-boot

[root@xx ~]# tree /data/portal/
/data/portal/
├── portal.jar
└── config
    └── application.properties   // I wish it read this

java -jar portal.jar不读取config文件夹中的属性,它固执地读取jar包中的相同文件。但是,基于24.3 Application Property Files jar应该读取config文件夹中的配置。 Maven项目也是如此。现在我必须通过--spring.config.location手动配置文件位置。

编辑: 我刚刚发现,使用--spring.config.location=file:/absolutepath/config/application.yml实际上并没有加载任何包含的属性文件。像这样:

spring.profiles.include: 'routes'

不会加载application-routes.yml,即使日志显示为The following profiles are active: routes

0 个答案:

没有答案