第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在spring boot中加載war文件之外的屬性文件

在spring boot中加載war文件之外的屬性文件

浮云間 2021-09-03 15:38:09
我需要從將部署在 tomcat 中的 spring boot war 外部加載 application.properties 文件。我嘗試了各種解決方案遺漏了一些東西嘗試在 Windows 中設置環(huán)境變量如下名稱:SPRING_CONFIG_NAME 值:D:/test/application.properties我為上述值嘗試了多個值,例如前綴中的 file:/// 和只有 file: as perfix 。沒有任何效果嘗試使用上下文參數(shù)是 tomcat,如下面提到的 SO 答案 https://stackoverflow.com/a/44697239/2751962嘗試在擴展 SpringBootServletIntializer 的主文件中像這樣加載protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class) .properties(getProperties()); } public static void main(String[] args) throws Exception {                SpringApplication.run(Application.class, args);                 SpringApplicationBuilder springApplicationBuilder = (SpringApplicationBuilder) (new SpringApplicationBuilder(Application.class))                 .sources(Application.class)                 .properties(getProperties())                 .run(args);            }            static Properties getProperties() {                Properties props = new Properties();                props.put("spring.config.location", "file:///D:/test/application.properties");                return props;            }我不確定我錯過了什么,請幫忙。
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 164 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號