造成此報錯信息的原因是 idea 的 .lock 文件仍就存在,但實際其對應(yīng)的進程已經(jīng)不存在,故處理辦法就是刪除 .lock 文件即可。
.lock 文件在類似于 /.config/JetBrains/IdeaIC2023.2 下,依據(jù)為:
/snap/intellij-idea-community/current/bin/idea.sh
其中包含:
CONFIG_HOME="${XDG_CONFIG_HOME:-${HOME}/.config}"
參考:
現(xiàn)象:
1、此工程之前實際正常 Run/Debug 過,每次修改代碼會在 idea 中重新 package 打包;
2、偶然執(zhí)行 Run/Debug 均報告 active: @profile.name@ 相關(guān)的錯誤信息,重新打包后依然報錯;
分析及解決:
1、基于 active: @profile.name@ 及啟動日志信息,明確 springboot 啟用了 @...@ 動態(tài)獲取配置的意圖;
2、檢查 idea 中 maven 插件,確保有選中合適的 profile 選項(有必要到根 pom.xml 中檢查對應(yīng)項);
2.a、若多選 maven 插件中的多個 profile 選項,則會按 pom.xml 中物理可用的最后一個來處理;
2.b、若全部不選、多選但全部沒有對應(yīng)項,則 @profile.name@ 無法被動態(tài)轉(zhuǎn)譯,進而保留不變;
3、在 maven 插件中選擇 compile/package,隨后 target/classes/application.yml 中查看結(jié)果;
參考:
1、
while scanning for the next tokenfound character ‘@‘ that cannot start any token.2、
聊聊 SpringBoot 中的兩種占位符:@*@ 和 ${*}3、
在構(gòu)建時期自動擴展info屬性4、
SpringBoot配置文件5、
Spring Boot中YAML屬性配置文件使用詳解6、
Spring boot2 使用profile 配置多環(huán)境7、
Could not resolve placeholder ‘xxx‘ in value “${xxx}“
來源:
相關(guān)命令:
sudo ip link 查看網(wǎng)絡(luò)接口
sudo vi /etc/netplan/01-network-manager-all.yaml 臨時對 netplan 改用 systemd-networkd 來替代默認的 network-manager
sudo netplan apply 啟用新的配置
sudo netplan try 試驗
如果 ping www.baidu.com 成功,則可以運行 sudo apt install network-manager,并恢復(fù) netplan 配置
來源:https://blog.csdn.net/ned_mahone/article/details/80081394
來源:https://blog.csdn.net/christine_ruan/article/details/7569782
來源:https://blog.csdn.net/qq_41055045/article/details/122038093
推薦適用于測試的 springboot 2.5 及以上版本中 application.yaml 配置示例:
# DataSource Config
spring:
datasource:
driver-class-name: org.h2.Driver
url: jdbc:h2:mem:test
username: root
password: test
sql:
init:
schema-locations: classpath:db/schema-h2.sql
data-locations: classpath:db/data-h2.sql
mode: always
不推薦的廢棄配置方式:
spring:
datasource:
schema: classpath:db/schema-h2.sql
data: classpath:db/data-h2.sql