当前位置: 首页>>代码示例>>Java>>正文


Java MapperFactoryBean类代码示例

本文整理汇总了Java中org.mybatis.spring.mapper.MapperFactoryBean的典型用法代码示例。如果您正苦于以下问题:Java MapperFactoryBean类的具体用法?Java MapperFactoryBean怎么用?Java MapperFactoryBean使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MapperFactoryBean类属于org.mybatis.spring.mapper包,在下文中一共展示了MapperFactoryBean类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newMyBatisMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private Object newMyBatisMapper(MapperBasicConfig config) {
    MapperFactoryBean mapperFactoryBean = new MapperFactoryBean();
    mapperFactoryBean.setMapperInterface(config.getMapperInterface());
    mapperFactoryBean.setSqlSessionFactory(this.getSqlSessionFactory(config.getDataSourceName(),
            config.getMapperInterface()));
    mapperFactoryBean.afterPropertiesSet();
    Object mapper = null;
    try {
        mapper = mapperFactoryBean.getObject();
    } catch (Exception e) {
        throw new MapperInitializeException(e);
    }
    return mapper;
}
 
开发者ID:baihui212,项目名称:tsharding,代码行数:16,代码来源:TShardingRoutingInvokeFactory.java

示例2: userDaoWithFactory

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
@Bean
public UserDao userDaoWithFactory() throws Exception {
  MapperFactoryBean<UserDao> mapperFactoryBean = new MapperFactoryBean<UserDao>();
  mapperFactoryBean.setMapperInterface(UserDao.class);
  mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
  mapperFactoryBean.afterPropertiesSet();
  return mapperFactoryBean.getObject();
}
 
开发者ID:lindzh,项目名称:mybatis-spring-1.2.2,代码行数:9,代码来源:ConfigurationSampleTest.java

示例3: postProcessBeanDefinitionRegistry

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) {
	if (!enabled) {
		return;
	}
	for (String beanName : registry.getBeanDefinitionNames()) {
		BeanDefinition beanDefinition = registry.getBeanDefinition(beanName);
		if (MapperFactoryBean.class.getName().equals(beanDefinition.getBeanClassName())) {
			beanDefinition.setBeanClassName(LazyFactoryBean.class.getName());
		}
	}
}
 
开发者ID:agwlvssainokuni,项目名称:springapp,代码行数:13,代码来源:MapperLazyInitializingPostProcesssor.java

示例4: deviceMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/** The Device mapper to be used by the managers
 * 
 * @return THe device mapper
 * @throws Exception If fetching the sql session factory failed
 */

@Bean
public DeviceMapper deviceMapper() throws Exception {
	MapperFactoryBean<DeviceMapper> mapperFactoryBean = new MapperFactoryBean<DeviceMapper>();
	mapperFactoryBean.setMapperInterface(DeviceMapper.class);
	mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
	return mapperFactoryBean.getObject();
}
 
开发者ID:mwcaisse,项目名称:AndroidFT,代码行数:14,代码来源:ApplicationConfig.java

示例5: deviceImageMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/** The Device Image mapper to be used by the managers
 * 
 * @return The device image mapper
 * @throws Exception If fetching the sql session factory failed
 */
@Bean 
public DeviceImageMapper deviceImageMapper() throws Exception {
	MapperFactoryBean<DeviceImageMapper> mapperFactoryBean = new MapperFactoryBean<DeviceImageMapper>();
	mapperFactoryBean.setMapperInterface(DeviceImageMapper.class);
	mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
	return mapperFactoryBean.getObject();
}
 
开发者ID:mwcaisse,项目名称:AndroidFT,代码行数:13,代码来源:ApplicationConfig.java

示例6: fileMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/** The File mapper to be used by the managers
 * 
 * @return The file mapper
 * @throws Exception If fetching the sql session factory failed
 */

@Bean
public FileMapper fileMapper() throws Exception {
	MapperFactoryBean<FileMapper> mapperFactoryBean = new MapperFactoryBean<FileMapper>();
	mapperFactoryBean.setMapperInterface(FileMapper.class);
	mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
	return mapperFactoryBean.getObject();
}
 
开发者ID:mwcaisse,项目名称:AndroidFT,代码行数:14,代码来源:ApplicationConfig.java

示例7: userMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/** The User mapper to be used by the managers
 * 
 * @return The user mapper
 * @throws Exception If fetching the sql session factory failed
 */
@Bean
public UserMapper userMapper() throws Exception {
	MapperFactoryBean<UserMapper> mapperFactoryBean = new MapperFactoryBean<UserMapper>();
	mapperFactoryBean.setMapperInterface(UserMapper.class);
	mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
	return mapperFactoryBean.getObject();
}
 
开发者ID:mwcaisse,项目名称:AndroidFT,代码行数:13,代码来源:ApplicationConfig.java

示例8: registrationKeyMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/** The RegistrationKey Mapper
 * 
 * @return The user mapper
 * @throws Exception If fetching the sql session factory failed
 */
@Bean
public RegistrationKeyMapper registrationKeyMapper() throws Exception {
	MapperFactoryBean<RegistrationKeyMapper> mapperFactoryBean = new MapperFactoryBean<RegistrationKeyMapper>();
	mapperFactoryBean.setMapperInterface(RegistrationKeyMapper.class);
	mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
	return mapperFactoryBean.getObject();
}
 
开发者ID:mwcaisse,项目名称:AndroidFT,代码行数:13,代码来源:ApplicationConfig.java

示例9: userAuthenticationTokenMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/** The UserAuthenticationToken mapper
 * 
 * @return The user mapper
 * @throws Exception If fetching the sql session factory failed
 */	
@Bean
public UserAuthenticationTokenMapper userAuthenticationTokenMapper() throws Exception {
	MapperFactoryBean<UserAuthenticationTokenMapper> mapperFactoryBean = new MapperFactoryBean<UserAuthenticationTokenMapper>();
	mapperFactoryBean.setMapperInterface(UserAuthenticationTokenMapper.class);
	mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
	return mapperFactoryBean.getObject();
}
 
开发者ID:mwcaisse,项目名称:AndroidFT,代码行数:13,代码来源:ApplicationConfig.java

示例10: requestMapper

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/** The Request Mapper to be used by the controllers
 * 
 * @return The request mapper
 * @throws Exception If fetching the sql session factory failed
 */

@Bean
public RequestMapper requestMapper() throws Exception {
	MapperFactoryBean<RequestMapper> mapperFactoryBean = new MapperFactoryBean<RequestMapper>();
	mapperFactoryBean.setMapperInterface(RequestMapper.class);
	mapperFactoryBean.setSqlSessionFactory(sqlSessionFactory());
	return mapperFactoryBean.getObject();
}
 
开发者ID:mwcaisse,项目名称:AndroidFT,代码行数:14,代码来源:ApplicationConfig.java

示例11: afterPropertiesSet

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
@PostConstruct
public void afterPropertiesSet() {
    logger.debug("No " + MapperFactoryBean.class.getName() + " found.");
}
 
开发者ID:baomidou,项目名称:mybatisplus-boot-starter,代码行数:5,代码来源:MybatisPlusAutoConfiguration.java

示例12: afterPropertiesSet

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
@PostConstruct
public void afterPropertiesSet() {
    logger.debug("No {} found.", MapperFactoryBean.class.getName());
}
 
开发者ID:abel533,项目名称:mapper-boot-starter,代码行数:5,代码来源:MapperAutoConfiguration.java

示例13: afterPropertiesSet

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
@PostConstruct
public void afterPropertiesSet() {
  logger.debug("No {} found.", MapperFactoryBean.class.getName());
}
 
开发者ID:mybatis,项目名称:spring-boot-starter,代码行数:5,代码来源:MybatisAutoConfiguration.java

示例14: doScan

import org.mybatis.spring.mapper.MapperFactoryBean; //导入依赖的package包/类
/**
 * Calls the parent search that will search and register all the candidates. Then the
 * registered objects are post processed to set them as MapperFactoryBeans
 */
@Override
protected Set<BeanDefinitionHolder> doScan(String... basePackages) {
  Set<BeanDefinitionHolder> beanDefinitions = super.doScan(basePackages);

  if (beanDefinitions.isEmpty()) {
    logger.warn("No MyBatis mapper was found in '" + MapperScannerConfigurer.this.basePackage
        + "' package. Please check your configuration.");
  } else {
    for (BeanDefinitionHolder holder : beanDefinitions) {
      GenericBeanDefinition definition = (GenericBeanDefinition) holder.getBeanDefinition();

      if (logger.isDebugEnabled()) {
        logger.debug("Creating MapperFactoryBean with name '" + holder.getBeanName()
            + "' and '" + definition.getBeanClassName() + "' mapperInterface");
      }

      // the mapper interface is the original class of the bean
      // but, the actual class of the bean is MapperFactoryBean
      definition.getPropertyValues().add("mapperInterface", definition.getBeanClassName());
      definition.setBeanClass(MapperFactoryBean.class);

      definition.getPropertyValues().add("addToConfig", MapperScannerConfigurer.this.addToConfig);

      boolean explicitFactoryUsed = false;
      if (StringUtils.hasLength(MapperScannerConfigurer.this.sqlSessionFactoryBeanName)) {
        definition.getPropertyValues().add("sqlSessionFactory", new RuntimeBeanReference(MapperScannerConfigurer.this.sqlSessionFactoryBeanName));
        explicitFactoryUsed = true;
      } else if (MapperScannerConfigurer.this.sqlSessionFactory != null) {
        definition.getPropertyValues().add("sqlSessionFactory", MapperScannerConfigurer.this.sqlSessionFactory);
        explicitFactoryUsed = true;
      }

      if (StringUtils.hasLength(MapperScannerConfigurer.this.sqlSessionTemplateBeanName)) {
        if (explicitFactoryUsed) {
          logger.warn("Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
        }
        definition.getPropertyValues().add("sqlSessionTemplate", new RuntimeBeanReference(MapperScannerConfigurer.this.sqlSessionTemplateBeanName));
        definition.getPropertyValues().add("sqlSessionFactory", null);
      } else if (MapperScannerConfigurer.this.sqlSessionTemplate != null) {
        if (explicitFactoryUsed) {
          logger.warn("Cannot use both: sqlSessionTemplate and sqlSessionFactory together. sqlSessionFactory is ignored.");
        }
        definition.getPropertyValues().add("sqlSessionTemplate", MapperScannerConfigurer.this.sqlSessionTemplate);
        definition.getPropertyValues().add("sqlSessionFactory", null);
      }
    }
  }

  return beanDefinitions;
}
 
开发者ID:okjsp,项目名称:okmakeover,代码行数:55,代码来源:MapperScannerConfigurer.java


注:本文中的org.mybatis.spring.mapper.MapperFactoryBean类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。