Skip to content

Commit 55e393d

Browse files
committed
Initialize when AbstractRoutingDataSource exists
1 parent 30ac101 commit 55e393d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

api-boot-project/api-boot-autoconfigure/src/main/java/org/minbox/framework/api/boot/autoconfigure/datasource/ApiBootDataSourceSwitchAutoConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.springframework.boot.context.properties.EnableConfigurationProperties;
1717
import org.springframework.context.annotation.Bean;
1818
import org.springframework.context.annotation.Configuration;
19+
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
1920

2021
import javax.sql.DataSource;
2122
import java.util.HashMap;
@@ -29,7 +30,7 @@
2930
* @author 恒宇少年
3031
*/
3132
@Configuration
32-
@ConditionalOnClass(ApiBootDataSource.class)
33+
@ConditionalOnClass({ApiBootDataSource.class, AbstractRoutingDataSource.class})
3334
@EnableConfigurationProperties(ApiBootDataSourceSwitchProperties.class)
3435
@AutoConfigureBefore(DataSourceAutoConfiguration.class)
3536
public class ApiBootDataSourceSwitchAutoConfiguration {

0 commit comments

Comments
 (0)