Spring 沒有在 config 檔案夾中檢測到我的 application.properties。組態檔:(敏感資訊隱藏)
server.port = 8090
spring.jpa.hibernate.ddl-auto=update
spring.datasource.url=jdbc:mysql://${MYSQL_HOST:URL}:3306/DB
spring.datasource.username=USER
spring.datasource.password=PW
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
debug=true
檔案夾結構:

服務器.java
@SpringBootApplication
@EnableAutoConfiguration
public class Server {
public static void main(String[] args) {
SpringApplication application = new SpringApplication(Server.class);
application.run();
}
}
我嘗試將屬性放在頂部和資源檔案夾中,似乎沒有任何效果。如果我嘗試通過 VM 選項加載它,它會說找不到資源。組態檔夾在 IntelliJ 中標記為資源檔案夾
uj5u.com熱心網友回復:
application.properties 檔案應該位于資源目??錄中。
uj5u.com熱心網友回復:
Spring 有一定的查找 application.properties 的順序
參考:
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/523571.html
標籤:爪哇春天
下一篇:CORS策略已阻止從源“http://localhost:3000”訪問“http://localhost:8080/blog/updatePost/2”處的XMLHttpRequest:
