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


Java RepositoryFactoryBeanSupport类代码示例

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


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

示例1: mapControllerAndEntityClasses

import org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport; //导入依赖的package包/类
/**
 * Iterate thru all beans and fetch the StatefulControllers
 *
 * @param reg
 * @return
 * @throws ClassNotFoundException
 */
private void mapControllerAndEntityClasses(
		BeanDefinitionRegistry reg,
		Map<String, Class<?>> controllerToEntityMapping,
		Map<Class<?>, String> entityToRepositoryMapping,
		Map<Class<?>, Set<String>> entityToControllerMappings) throws ClassNotFoundException {

	// Loop thru the bean registry
	//
	for(String bfName : reg.getBeanDefinitionNames()) {

		BeanDefinition bf = reg.getBeanDefinition(bfName);

		if (bf.isAbstract()) {
			logger.debug("Skipping abstract bean " + bfName);
			continue;
		}

		Class<?> clazz = getClassFromBeanDefinition(bf, reg);

		if (clazz == null) {
			logger.debug("Unable to resolve class for bean " + bfName);
			continue;
		}

		// If it's a StatefulController, map controller to the entity and the entity to the controller
		//
		if (ReflectionUtils.isAnnotationPresent(clazz, StatefulController.class)) {
			mapEntityWithController(controllerToEntityMapping, entityToControllerMappings, bfName, clazz);
		}

		// Else, if the Bean is a Repository, then map the
		// Entity associated with the Repo to the PersistenceSupport object
		//
		else if (RepositoryFactoryBeanSupport.class.isAssignableFrom(clazz)) {
			mapEntityToRepository(entityToRepositoryMapping, bfName, bf);
		}
	}
}
 
开发者ID:statefulj,项目名称:statefulj,代码行数:46,代码来源:StatefulFactory.java


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