org.mybatis.spring.mapper.ClassPathMapperScanner Java Examples
The following examples show how to use
org.mybatis.spring.mapper.ClassPathMapperScanner.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MyBatisPlusAutoConfiguration.java From mybatis-plus-sharding-jdbc-spring-boot-starter with Apache License 2.0 | 6 votes |
@Override public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { logger.debug("Searching for mappers annotated with @Mapper"); ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); try { if (this.resourceLoader != null) { scanner.setResourceLoader(this.resourceLoader); } List<String> packages = AutoConfigurationPackages.get(this.beanFactory); if (logger.isDebugEnabled()) { for (String pkg : packages) { logger.debug("Using auto-configuration base package '" + pkg + "'"); } } scanner.setAnnotationClass(Mapper.class); scanner.registerFilters(); scanner.doScan(StringUtils.toStringArray(packages)); } catch (IllegalStateException ex) { logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled." + ex); } }
Example #2
Source File: LocMybatisAutoConfiguration.java From loc-framework with MIT License | 6 votes |
private void createClassPathMapperScanner(BeanDefinitionRegistry registry, String prefixName) { ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); try { if (this.resourceLoader != null) { scanner.setResourceLoader(this.resourceLoader); } List<String> packages = AutoConfigurationPackages.get(beanFactory); packages.forEach(pkg -> log.info("Using auto-configuration base package '{}'", pkg)); scanner.setAnnotationClass(Mapper.class); scanner.setSqlSessionFactoryBeanName(prefixName + "SessionFactory"); scanner.registerFilters(); scanner.doScan(StringUtils.toStringArray(packages)); } catch (IllegalStateException ex) { log.info("Could not determine auto-configuration package", ex); } }
Example #3
Source File: MybatisPlusAutoConfig.java From seata-samples with Apache License 2.0 | 5 votes |
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { MybatisPlusAutoConfig.logger.debug("Searching for mappers annotated with @Mapper"); ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); try { if (this.resourceLoader != null) { scanner.setResourceLoader(this.resourceLoader); } List<String> packages = AutoConfigurationPackages.get(this.beanFactory); if (MybatisPlusAutoConfig.logger.isDebugEnabled()) { Iterator iterator = packages.iterator(); while(iterator.hasNext()) { String pkg = (String)iterator.next(); MybatisPlusAutoConfig.logger.debug("Using auto-configuration base package '" + pkg + "'"); } } scanner.setAnnotationClass(Mapper.class); scanner.registerFilters(); scanner.doScan(StringUtils.toStringArray(packages)); } catch (IllegalStateException var7) { MybatisPlusAutoConfig.logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled." + var7); } }
Example #4
Source File: MybatisPlusAutoConfig.java From seata-samples with Apache License 2.0 | 5 votes |
public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { MybatisPlusAutoConfig.logger.debug("Searching for mappers annotated with @Mapper"); ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); try { if (this.resourceLoader != null) { scanner.setResourceLoader(this.resourceLoader); } List<String> packages = AutoConfigurationPackages.get(this.beanFactory); if (MybatisPlusAutoConfig.logger.isDebugEnabled()) { Iterator iterator = packages.iterator(); while(iterator.hasNext()) { String pkg = (String)iterator.next(); MybatisPlusAutoConfig.logger.debug("Using auto-configuration base package '" + pkg + "'"); } } scanner.setAnnotationClass(Mapper.class); scanner.registerFilters(); scanner.doScan(StringUtils.toStringArray(packages)); } catch (IllegalStateException var7) { MybatisPlusAutoConfig.logger.debug("Could not determine auto-configuration package, automatic mapper scanning disabled." + var7); } }