@DataSource("") 多源数据库无效
版本:renren-cloud |
开发环境:IDEA |
img[//cdn.renren.io/f3c07202104091123598010.jpg]
[pre]
/**
* 项目管理
*
* @author 0719 863121318@gmail.com
* @since 3.0 2021-04-08
*/
@Service
@DataSource("hgdf")
public class projectServiceImpl extends CrudServiceImpl<ProjectDao, projectEntity, projectDTO> implements ProjectService {
@Override
public QueryWrapper<projectEntity> getWrapper(Map<String, Object> params){
QueryWrapper<projectEntity> wrapper = new QueryWrapper<>();
return wrapper;
}
}
[/pre]
使用多源数据库一直失败,nacos中的配置是有什么特殊的写法吗
[pre]
dynamic:
datasource:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/xxxx_renren?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: xxxx
password: xxxx
hgdf:
#MySQL-HGDF
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/xxxx_manage?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: xxxx
password: xxxx
spring:
redis:
host: 127.0.0.1
port: 6379
database: 0
password:
timeout: 30s
datasource:
druid:
#MySQL
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/xxxx_renren?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: xxxx
password: xxxx
hgdf:
#MySQL-HGDF
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/xxxx_manage?useUnicode=true&characterEncoding=UTF-8&useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true
username: xxxx
password: xxxx
initial-size: 2
max-active: 5
min-idle: 2
max-wait: 6000
pool-prepared-statements: true
max-pool-prepared-statement-per-connection-size: 5
time-between-eviction-runs-millis: 60000
min-evictable-idle-time-millis: 300000
test-while-idle: true
test-on-borrow: false
test-on-return: false
filter:
stat:
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: false
wall:
config:
multi-statement-allow: true
mybatis-plus:
mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔
typeAliasesPackage: io.renren.entity
global-config:
#数据库相关配置
db-config:
#主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID";
id-type: ID_WORKER
banner: false
#原生配置
configuration:
map-underscore-to-camel-case: true
cache-enabled: false
call-setters-on-nulls: true
jdbc-type-for-null: 'null'
[/pre]