@Configuration
@MapperScan(basePackages = "/scaffold/mastermapper", sqlSessionFactoryRef = "masterSqlSessionFactory")
public class MybatisMasterConfiguer {
@Primary
@Bean(name = "masterDataSource")
@ConfigurationProperties(prefix = "spring.datasource.druid.one")
public DataSource masterDataSource() {
return DruidDataSourceBuilder.create().build();
}
@Bean(name = "masterTransactionManager")
@Primary
public DataSourceTransactionManager masterTransactionManager() {
return new DataSourceTransactionManager(masterDataSource());
}
@Bean(name = "masterSqlSessionFactory")
@Primary
public SqlSessionFactory masterSqlSessionFactory(@Qualifier("masterDataSource") DataSource masterDataSource)
throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(masterDataSource);
return sessionFactory.getObject();
}
}
一直报这个错Cannot determine embedded database driver class for database type NONE
exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException:
能帮看下为什么吗?
master 数据源配置
spring.datasource.druid.one.url=jdbc:mysql://localhost:3307/socks?useSSL=false&useUnicode=true&characterEncoding=utf8 spring.datasource.druid.one.username=root spring.datasource.druid.one.password=111111 spring.datasource.druid.one.driverClassName=com.mysql.jdbc.Driver
cluster 数据源配置
spring.datasource.druid.two.url=jdbc:mysql://localhost:3308/socks?useSSL=false&useUnicode=true&characterEncoding=utf8 spring.datasource.druid.two.username=root spring.datasource.druid.two.password=123456 spring.datasource.druid.two.driverClassName=com.mysql.jdbc.Driver
@Configuration @MapperScan(basePackages = "/scaffold/mastermapper", sqlSessionFactoryRef = "masterSqlSessionFactory") public class MybatisMasterConfiguer {
} 一直报这个错Cannot determine embedded database driver class for database type NONE exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: 能帮看下为什么吗?