Last active
August 29, 2015 14:24
-
-
Save Kotlin-Native/60c5d5ed849b4bf4115c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void connectCdiAndSpring(@Observes AfterBeanDiscovery event, BeanManager manager) | |
| throws ClassNotFoundException { | |
| ConfigurableApplicationContext springContext | |
| = new ClassPathXmlApplicationContext(new String[] { "classpath:application-context.xml"}, false); | |
| springContext.addBeanFactoryPostProcessor(new DependencyRegisteringPostProcessor(manager, cdiBeans)); | |
| springContext.refresh(); | |
| for (String beanName: springContext.getBeanDefinitionNames()) { | |
| BeanDefinition beanDefinition | |
| = springContext.getBeanFactory().getBeanDefinition(beanName); | |
| if (!CdiScope.class.getName().equals(beanDefinition.getScope())) { | |
| event.addBean(createBean(…)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment