@MapperScanner 没有
时间: 2023-10-26 13:26:14 浏览: 191
在提到SpringBoot中的@MapperScanner时,可以看到它的注解上加了@Import注解,且引入的MapperScannerRegistrar类是ImportBeanDefinitionRegistrar的子类。如果在SpringBoot的启动主类中没有定义@MapperScan注解,那么SpringBoot的BeanDefinitionRegistry组件将不会加载MapperFactoryBean和MapperScannerConfigurer类,而是会加载MapperScannerRegistrarNotFoundConfiguration内部类。这就意味着,如果没有显式使用@MapperScan注解,SpringBoot会使用自动配置类AutoConfiguredMapperScannerRegistrar来进行Mapper的扫描注册。所以,如果没有使用@MapperScan注解,@MapperScanner仍然能够生效,只是会使用自动配置的方式来注册Mapper接口。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [@Mapper注解和@MapperScan注解的关联性,以及源码分析](https://blog.csdn.net/qq_38663602/article/details/113793952)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [@MapperScan原理探究](https://blog.csdn.net/qq_32099833/article/details/128352245)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文