快車道

           

          SpringBoot 工程 Run/Debug 時報錯:active: @profile.name@ 相關的 @ 不識別

          現象:
          1、此工程之前實際正常 Run/Debug 過,每次修改代碼會在 idea 中重新 package 打包;
          2、偶然執行 Run/Debug 均報告 active: @profile.name@ 相關的錯誤信息,重新打包后依然報錯;

          分析及解決:
          1、基于 active: @profile.name@ 及啟動日志信息,明確 springboot 啟用了 @...@ 動態獲取配置的意圖;
          2、檢查 idea 中 maven 插件,確保有選中合適的 profile 選項(有必要到根 pom.xml 中檢查對應項);
           2.a、若多選 maven 插件中的多個 profile 選項,則會按 pom.xml 中物理可用的最后一個來處理;
           2.b、若全部不選、多選但全部沒有對應項,則 @profile.name@ 無法被動態轉譯,進而保留不變;
          3、在 maven 插件中選擇 compile/package,隨后 target/classes/application.yml 中查看結果;

          參考:
          1、while scanning for the next tokenfound character ‘@‘ that cannot start any token.
          2、聊聊 SpringBoot 中的兩種占位符:@*@ ${*}
          3、在構建時期自動擴展info屬性
          4、SpringBoot配置文件
          5、Spring BootYAML屬性配置文件使用詳解
          6、Spring boot2 使用profile 配置多環境
          7、Could not resolve placeholder ‘xxx‘ in value “${xxx}“

          posted on 2023-08-29 17:18 快車道 閱讀(70) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          統計

          常用鏈接

          留言簿(1)

          我參與的團隊

          隨筆分類(3)

          隨筆檔案(11)

          IT學習網站

          路過的博客

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 仲巴县| 天祝| 萝北县| 将乐县| 潜山县| 宜昌市| 买车| 玉树县| 鹤岗市| 长顺县| 广平县| 临湘市| 道孚县| 宝坻区| 沙坪坝区| 万全县| 宁安市| 绍兴县| 临邑县| 万安县| 呼玛县| 阿图什市| 建始县| 昌邑市| 长宁区| 巍山| 汉中市| 丹棱县| 济阳县| 南昌市| 湟中县| 洛阳市| 稷山县| 华容县| 临西县| 阳曲县| 岳阳市| 靖边县| 留坝县| 东乡| 内丘县|