本文整理汇总了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);
}
}
}