Skip to content

Instantly share code, notes, and snippets.

@Kotlin-Native
Created July 9, 2015 13:35
Show Gist options
  • Select an option

  • Save Kotlin-Native/e2f3eb1fa6f4de57142d to your computer and use it in GitHub Desktop.

Select an option

Save Kotlin-Native/e2f3eb1fa6f4de57142d to your computer and use it in GitHub Desktop.
SpringCdiExtension connectCdiAndSpring
public void connectCdiAndSpring(@Observes AfterBeanDiscovery event, BeanManager manager) throws ClassNotFoundException {
ConfigurableApplicationContext springContext = new ClassPathXmlApplicationContext("classpath:context.xml");
for (String beanName: applicationContext.getBeanDefinitionNames()) {
BeanDefinition beanDefinition = applicationContext.getBeanFactory().getBeanDefinition(beanName);
event.addBean(createBean(beanDefinition));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment