yml是springboot中的配置文件,有时我们看一个项目会看到多个配置文件,application-dev.yml
application-test.yml application-prod.yml 有时看到多个配置文件,不知道哪个要用哪个对于初学者来说,这个可能是简单又重要的。
配置文件需要两个
application.yml
spring:
#环境: dev开发环境|test:测试环境|prod:生产环境
profiles:
active: dev
application-dev.yml
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://localhost:3306/springboot?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=GMT%2B8&useSSL=false
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
druid:
initial-size: 3
mybatis:
mapper-locations: classpath:mapper/*.xml
type-aliases-package: com.xue
configuration:
map-underscore-to-camel-case: true
application.yml文件里的active即可对应
更多推荐