SpringBoot environment configuration file
- Spring Boot can provide different Profile files for different environments.
- Profile default file naming format application- {env} .yml
- Use spring.profiles.active option to specify a different profile
Source Address: QQ group 814,077,650, self-help group sharing download
application.yml
spring:
profiles:
active: dev #改为prd就是线上配置
application-dev.yml
#debug=true
debug: false
#server.port=80
#前缀相同的配置项,idea会自动进行归纳
server:
port: 8000
servlet:
context-path: /
thymeleaf:
cache: false
spring:
mvc:
date-format: yyyy-MM-dd
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://localhost:3306/test
username: root
password: root
application-prd.yml
#debug=true
debug: false
#server.port=80
#前缀相同的配置项,idea会自动进行归纳
server:
port: 80
servlet:
context-path: /
#idean对yml有良好支持可自动生成
spring:
thymeleaf:
cache: false
mvc:
date-format: yyyy-MM-dd
datasource:
driver-class-name: com.mysql.jdbc.Driver
url: jdbc:mysql://166.87.93.124:3310/production
username: admin
password: 123!@#$