本文整理汇总了Java中org.mybatis.spring.mapper.ClassPathMapperScanner类的典型用法代码示例。如果您正苦于以下问题:Java ClassPathMapperScanner类的具体用法?Java ClassPathMapperScanner怎么用?Java ClassPathMapperScanner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClassPathMapperScanner类属于org.mybatis.spring.mapper包,在下文中一共展示了ClassPathMapperScanner类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: registerBeanDefinitions
import org.mybatis.spring.mapper.ClassPathMapperScanner; //导入依赖的package包/类
@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);
}
}
开发者ID:baomidou,项目名称:mybatisplus-boot-starter,代码行数:27,代码来源:MybatisPlusAutoConfiguration.java
示例2: createClassPathMapperScanner
import org.mybatis.spring.mapper.ClassPathMapperScanner; //导入依赖的package包/类
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);
}
}
开发者ID:lord-of-code,项目名称:loc-framework,代码行数:20,代码来源:LocMybatisAutoConfiguration.java
示例3: registerBeanDefinitions
import org.mybatis.spring.mapper.ClassPathMapperScanner; //导入依赖的package包/类
@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()) {
packages.forEach(pkg -> 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);
}
}
开发者ID:mybatis,项目名称:spring-boot-starter,代码行数:25,代码来源:MybatisAutoConfiguration.java
注:本文中的org.mybatis.spring.mapper.ClassPathMapperScanner类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论