File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
activerecord/src/main/java/io/mybatis/activerecord/spring/boot/autoconfigure Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change 1818
1919import io .mybatis .activerecord .spring .MapperProvider ;
2020import org .mybatis .spring .SqlSessionTemplate ;
21- import org .springframework .beans .factory .annotation . Autowired ;
21+ import org .springframework .beans .factory .InitializingBean ;
2222import org .springframework .boot .autoconfigure .condition .ConditionalOnMissingBean ;
2323import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
2424import org .springframework .boot .context .properties .EnableConfigurationProperties ;
@@ -53,12 +53,19 @@ public MapperProvider springMapperRegistry(SqlSessionTemplate sqlSessionTemplate
5353 * 自动注册为默认的 Mapper 提供者
5454 * <p>
5555 * 当使用多数据源时,需要通过 {@link org.springframework.context.annotation.Primary} 注解指定主要的默认的 {@link MapperProvider}
56- *
57- * @param mapperProvider
5856 */
59- @ Autowired
60- public void registerDefaultSpringMapperRegistry (MapperProvider mapperProvider ) {
61- mapperProvider .registerAsDefault ();
57+ @ Configuration
58+ public static class AutoRegisterConfiguration implements InitializingBean {
59+ private final MapperProvider mapperProvider ;
60+
61+ public AutoRegisterConfiguration (MapperProvider mapperProvider ) {
62+ this .mapperProvider = mapperProvider ;
63+ }
64+
65+ @ Override
66+ public void afterPropertiesSet () {
67+ mapperProvider .registerAsDefault ();
68+ }
6269 }
6370
6471}
Original file line number Diff line number Diff line change 5959 </modules >
6060
6161 <properties >
62- <revision >1.0.3 </revision >
62+ <revision >1.0.4 </revision >
6363 <maven .compiler.source>8</maven .compiler.source>
6464 <maven .compiler.target>8</maven .compiler.target>
6565 <project .build.sourceEncoding>UTF-8</project .build.sourceEncoding>
7272 <mybatis-spring .version>2.0.6</mybatis-spring .version>
7373 <mybatis-spring-boot .version>2.2.0</mybatis-spring-boot .version>
7474
75- <springframework .version>5.3.9 </springframework .version>
76- <springboot .version>2.5.3 </springboot .version>
75+ <springframework .version>5.3.13 </springframework .version>
76+ <springboot .version>2.6.1 </springboot .version>
7777
7878 <log4j .version>1.2.17</log4j .version>
7979 <junit .version>4.13</junit .version>
You can’t perform that action at this time.
0 commit comments