mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-19 09:55:16 +08:00
读写分离控制
This commit is contained in:
parent
f8ef90ab98
commit
d416394e7e
@ -15,6 +15,8 @@ spring:
|
|||||||
login-username: ruoyi
|
login-username: ruoyi
|
||||||
login-password: 123456
|
login-password: 123456
|
||||||
dynamic:
|
dynamic:
|
||||||
|
#是否开启读写分离
|
||||||
|
ms: false
|
||||||
druid:
|
druid:
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initialSize: 5
|
initialSize: 5
|
||||||
|
|||||||
@ -14,6 +14,8 @@ spring:
|
|||||||
login-username: ruoyi
|
login-username: ruoyi
|
||||||
login-password: 123456
|
login-password: 123456
|
||||||
dynamic:
|
dynamic:
|
||||||
|
#是否开启读写分离
|
||||||
|
ms: false
|
||||||
druid:
|
druid:
|
||||||
# 初始连接数
|
# 初始连接数
|
||||||
initialSize: 5
|
initialSize: 5
|
||||||
@ -37,14 +39,6 @@ spring:
|
|||||||
filters: stat # 注意这个值和druid原生不一致,默认启动了stat
|
filters: stat # 注意这个值和druid原生不一致,默认启动了stat
|
||||||
webStatFilter:
|
webStatFilter:
|
||||||
enabled: true
|
enabled: true
|
||||||
statViewServlet:
|
|
||||||
enabled: true
|
|
||||||
# 设置白名单,不填则允许所有访问
|
|
||||||
allow:
|
|
||||||
url-pattern: /druid/*
|
|
||||||
# 控制台管理用户名和密码
|
|
||||||
login-username: ruoyi
|
|
||||||
login-password: 123456
|
|
||||||
filter:
|
filter:
|
||||||
stat:
|
stat:
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@ -22,7 +22,9 @@ import java.io.IOException;
|
|||||||
public class DynamicDataSourceConfig {
|
public class DynamicDataSourceConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
|
@ConditionalOnProperty(name = "spring.datasource.dynamic.ms", havingValue = "true")
|
||||||
public MasterSlaveAutoRoutingPlugin masterSlaveAutoRoutingPlugin(){
|
public MasterSlaveAutoRoutingPlugin masterSlaveAutoRoutingPlugin(){
|
||||||
|
System.out.println("-----------读写分离已开启------------");
|
||||||
return new MasterSlaveAutoRoutingPlugin();
|
return new MasterSlaveAutoRoutingPlugin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user