troyzhxu / bean-searcher

🔥🔥🔥 A read-only ORM focusing on advanced query, naturally supports joined tables, and avoids DTO/VO conversion, making it possible to realize complex query in one line of code !
https://bs.zhxu.cn
Apache License 2.0
1.31k stars 148 forks source link

多数据源出错 #83

Closed ericqy197206 closed 10 months ago

ericqy197206 commented 1 year ago

多数据源的时候,因为存在多个DataSource cn.zhxu.bs.boot.BeanSearcherAutoConfiguration中 @Bean @ConditionalOnMissingBean(SqlExecutor.class) public SqlExecutor sqlExecutor(ObjectProvider dataSource, ObjectProvider<List> namedDataSources, ObjectProvider slowListener, BeanSearcherProperties config) { ... 这个bean初始化的时候,因为有多个DataSource,创建会报错 required a single bean but 2 were found

troyzhxu commented 10 months ago

在默认数据源上面使用 @Primary 注解即可。