Be able to reuse spring beans in CDI application.
You have two ways to use this extension.
public class AppCtxProducer {
@Produces
public ConfigurableApplicationContext create() {
return new ClassPathXmlApplicationContext("app-ctx.xml");
}
public void close(@Disposes final ConfigurableApplicationContext ctx) {
ctx.close();
}
}
Note: this is pretty useful but not portable (even if it should work on main CDI implementation
Create a classpath resource called rmannibucau-spring-cdi.xml and import your spring app in this file. It will ignore produced ConfigurableApplicationContext and is portable.
@Spring
@Inject
private SomeSpringStuff bean;