factory = new DefaultListableBeanFactory();
// Register factory bean for repository
BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(DummyRepositoryFactoryBean.class);
builder.addPropertyValue("repositoryInterface", UserRepository.class);
factory.registerBeanDefinition("repository", builder.getBeanDefinition());
// Register predicting BeanPostProcessor
RepositoryInterfaceAwareBeanPostProcessor processor = new RepositoryInterfaceAwareBeanPostProcessor();
processor.setBeanFactory(factory);