sprinboot多環境切換配置文件

刪除application.properties文件,新建application.yml文件更加簡介

注意:編譯時application.yml會自動解析成application.properties

application.yml:

spring:
  profiles:
    active: dev

意思是指定生產環境時使用application-dev.yml配置文件(springboot會根據application-(你的名字).yml)去查找並使用

創建application-dev.yml:

server:
  port: 1111
  tomcat:
    max-http-post-size: 500MB
spring:
  datasource:
    username: root
    password: root
    url: jdbc:mysql://localhost:3306/kungfu?useCharactorEncoding=utf-8&useSSL=false&serverTimezone=UTC
    driver-class-name: com.mysql.cj.jdbc.Driver
  devtools:
    livereload:
      enabled: true
    restart:
      enabled: true
  servlet:
    multipart:
      max-file-size: 500MB
      max-request-size: 500MB
jpa:
    show-sql: true
    hibernate:
      ddl-auto: update

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章