spring boot、maven自定義配置檔案
阿新 • • 發佈:2018-12-11
在pom.xml中設定<profiles>標籤來指定配置檔案載入路徑
<profiles> <profile> <id>local</id> <build> <resources> <resource> <directory>src/main/profile</directory> </resource> <resource> <directory>src/main/resources</directory> </resource> </resources> </build> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> </profiles>
resources屬性指定了配置檔案資源的路徑
id是可以為maven在編譯的時候指定對應值然後使用對應id的profile
activationByDefault屬性指定該profile為預設載入profile
如果在編譯時mvn -P local命令,這樣就會載入id為local的profile