/** * 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); } } }