本文整理汇总了Java中org.springframework.data.mongodb.repository.support.MongoRepositoryFactory类的典型用法代码示例。如果您正苦于以下问题:Java MongoRepositoryFactory类的具体用法?Java MongoRepositoryFactory怎么用?Java MongoRepositoryFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MongoRepositoryFactory类属于org.springframework.data.mongodb.repository.support包,在下文中一共展示了MongoRepositoryFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: postProcessBeforeInitialization
import org.springframework.data.mongodb.repository.support.MongoRepositoryFactory; //导入依赖的package包/类
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
Repository annotation = AnnotationUtils.findAnnotation(bean.getClass(), Repository.class);
if (annotation == null) {
return bean;
}
Class<?> supperClass = bean.getClass().getSuperclass();
if (!LodsveMongoRepository.class.equals(supperClass)) {
return bean;
}
Class<?> domainClass = GenericUtils.getGenericParameter0(bean.getClass());
MongoRepositoryFactory repositoryFactory = context.getBean(MongoRepositoryFactory.class);
MongoEntityInformation information = repositoryFactory.getEntityInformation(domainClass);
BeanWrapper beanWrapper = new BeanWrapperImpl(bean);
beanWrapper.setPropertyValue("entityInformation", information);
return bean;
}
示例2: initMongoRepositoryFactory
import org.springframework.data.mongodb.repository.support.MongoRepositoryFactory; //导入依赖的package包/类
private void initMongoRepositoryFactory() {
BeanDefinitionBuilder mongoRepositoryFactory = BeanDefinitionBuilder.genericBeanDefinition(MongoRepositoryFactory.class);
mongoRepositoryFactory.addConstructorArgReference(MONGO_TEMPLATE_BEAN_NAME);
BEAN_DEFINITION_MAP.put(MONGO_REPOSITORY_FACTORY_BEAN_NAME, mongoRepositoryFactory.getBeanDefinition());
}