spring boot yml 多环境和properties不同的是只需要一个文件,多个环境用---隔开即可.
application.yml文件:
(数据源用spring.datasource.xxxname来写)
server:
# 端口号
port: 8008
context-path: /demo
spring:
profiles:
active: dev
# active: dev
#cluster 数据源配置
datasource:
cluster:
driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@xxx.xx.xx.xx:1521:orcl
username: test
password: test
thymeleaf:
cache: false
output:
ansi:
enabled: always
---
#生产环境
spring:
profiles: proc
# master 数据源配置
datasource:
master:
driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@xxx.xx.xx.xx:1521:orcl
username: test
password: test
application:
name: 生产环境
---
#测试环境
spring:
profiles: dev
# master 数据源配置
datasource:
master:
driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@localhost:1521:orcl
username: test
password: test
application:
name: 测试环境
官方示例:
Paste_Image.png
网友评论
因为activiti操作数据库用的也是mybatis,所有有冲突@mapper和@mapperScan用不了
我的这篇文章里面有写到这2个标签可以使用