org.mybatis.spring.mapper.MapperScannerConfigurer Java Examples

The following examples show how to use org.mybatis.spring.mapper.MapperScannerConfigurer. 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: MapperLoader.java    From Shop-for-JavaWeb with MIT License 6 votes vote down vote up
@Override
public void afterPropertiesSet() throws Exception {
	try {
		service = Executors.newScheduledThreadPool(1);
		
		// 获取xml所在包
		MapperScannerConfigurer config = context.getBean(MapperScannerConfigurer.class);
		Field field = config.getClass().getDeclaredField("basePackage");
		field.setAccessible(true);
		basePackage = (String) field.get(config);
		
		// 触发文件监听事件
		scanner = new Scanner();
		scanner.scan();

		service.scheduleAtFixedRate(new Task(), 5, 5, TimeUnit.SECONDS);

	} catch (Exception e1) {
		e1.printStackTrace();
	}

}
 
Example #2
Source File: MybatisPlusConfig.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
/**
 * 相当于顶部的:
 * {@code @MapperScan("com.baomidou.springboot.mapper*")}
 * 这里可以扩展,比如使用配置文件来配置扫描Mapper的路径
 */
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
    MapperScannerConfigurer scannerConfigurer = new MapperScannerConfigurer();
    scannerConfigurer.setBasePackage("com.moxi.mogublog.spider.mapper*");
    return scannerConfigurer;
}
 
Example #3
Source File: MybatisPlusConfig.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
/**
 * 相当于顶部的:
 * {@code @MapperScan("com.baomidou.springboot.mapper*")}
 * 这里可以扩展,比如使用配置文件来配置扫描Mapper的路径
 */
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
    MapperScannerConfigurer scannerConfigurer = new MapperScannerConfigurer();
    scannerConfigurer.setBasePackage("com.moxi.mogublog.picture.mapper*");
    return scannerConfigurer;
}
 
Example #4
Source File: MybatisPlusConfig.java    From mogu_blog_v2 with Apache License 2.0 5 votes vote down vote up
/**
 * 相当于顶部的:
 * {@code @MapperScan("com.baomidou.springboot.mapper*")}
 * 这里可以扩展,比如使用配置文件来配置扫描Mapper的路径
 */
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
    MapperScannerConfigurer scannerConfigurer = new MapperScannerConfigurer();
    scannerConfigurer.setBasePackage("com.moxi.mogublog.xo.mapper*");
    return scannerConfigurer;
}
 
Example #5
Source File: RootConfig.java    From PedestrianDetectionSystem with Apache License 2.0 5 votes vote down vote up
@Bean
public MapperScannerConfigurer initMapperScannerConfigurer(){
    MapperScannerConfigurer msc = new MapperScannerConfigurer();
    msc.setBasePackage("com.webprague");
    msc.setSqlSessionFactoryBeanName("sqlSessionFactory");
    msc.setAnnotationClass(Repository.class);
    return msc;
}
 
Example #6
Source File: DeployerConfiguration.java    From oneops with Apache License 2.0 5 votes vote down vote up
@Bean
public CmsWoProvider getWoProvider(MapperScannerConfigurer mapperScannerConfigurer,
    DJMapper djMapper, DJDpmtMapper djDpmtMapper, CmsCmRfcMrgProcessor rfcProcessor) {
  CmsWoProvider woProvider = new CmsWoProvider();
  woProvider.setDjMapper(djMapper);
  woProvider.setDpmtMapper(djDpmtMapper);
  woProvider.setCmsUtil(new CmsUtil());
  woProvider.setCmrfcProcessor(rfcProcessor);
  return woProvider;
}
 
Example #7
Source File: LocMybatisAutoConfiguration.java    From loc-framework with MIT License 5 votes vote down vote up
private void createBasePackageScanner(BeanDefinitionRegistry registry, String basePackage,
    String prefixName) {
  MapperScannerConfigurer scannerConfigurer = new MapperScannerConfigurer();
  scannerConfigurer.setBasePackage(basePackage);
  scannerConfigurer.setSqlSessionFactoryBeanName(prefixName + "SessionFactory");
  scannerConfigurer.postProcessBeanDefinitionRegistry(registry);
}
 
Example #8
Source File: MybatisConfiguration.java    From huanhuan-blog with Apache License 2.0 5 votes vote down vote up
/**
 * 扫描跑mapper包下的所有接口,作为mybatis接口类,并注册为spring的bean
 */
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
    MapperScannerConfigurer scannerConfigurer = new MapperScannerConfigurer();
    scannerConfigurer.setAddToConfig(true);
    scannerConfigurer.setBasePackage("com.huan.**.mapper");
    return scannerConfigurer;
}
 
Example #9
Source File: TenantConfig.java    From jshERP with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 相当于顶部的:
 * {@code @MapperScan("com.jsh.erp.datasource.mappers*")}
 * 这里可以扩展,比如使用配置文件来配置扫描Mapper的路径
 */
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
    MapperScannerConfigurer scannerConfigurer = new MapperScannerConfigurer();
    scannerConfigurer.setBasePackage("com.jsh.erp.datasource.mappers*");
    return scannerConfigurer;
}
 
Example #10
Source File: DeployerConfiguration.java    From oneops with Apache License 2.0 4 votes vote down vote up
@Bean
public MapperScannerConfigurer getMapperScannerConfigurer() {
  MapperScannerConfigurer mapperScannerConfigurer = new MapperScannerConfigurer();
  mapperScannerConfigurer.setBasePackage("com.oneops.cms.dj.dal");
  return mapperScannerConfigurer;
}
 
Example #11
Source File: DataConfig.java    From springboot_cwenao with MIT License 4 votes vote down vote up
@Bean
public MapperScannerConfigurer mapperScannerConfigurer() {
    MapperScannerConfigurer bean = new MapperScannerConfigurer();
    bean.setBasePackage("com.bootcwenao.esserver.mapper");
    return bean;
}