Try   HackMD

相關的spring boot application properties設定

spring.profiles.active=prod

根據active設定的參數,會決定專案讀哪個properties檔

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

命名格式:application-{profile}.properties


server.port=8080

設定port


server.servlet.context-path=/camiol-api

設定專案的網址名稱


spring.main.banner-mode=off

設定spring boot 啟動的圖樣是否顯示


spring.datasource.url=jdbc:mysql://127.0.0.1:3306/mydb?useUnicode=yes&characterEncoding=UTF-8
spring.datasource.username=root
spring.datasource.password=1qaz@WSX
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

設定DB連線資訊


spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect

設定使用的資料庫平台


spring.jpa.hibernate.ddl-auto=update

設定服務起來時要用何種方式執行ddl指令, 有create, update, create-drop 等形式。

create: 啟動時建立Table, 下次啟動會覆蓋上次的, 故會造成資料遺失

update: 若無Table則啟動時建立, 若有則視有無變更自動Update

create-drop:啟動時建立Table, 當次Session關閉則刪除


spring.jpa.show-sql=true

設定是否顯示SQL


tags: Spring boot