I know this sounds strange, mixing CDI (Weld) and Spring for the controller.
But imagine this situation :
Now one question arise is that, inside my controller, how can i access my service object ?
Something like this wouldnt work i think :
@Named
@ConversationScoped
public class MyBean {
@Named
private SomeOtherBeanManagedByCDI myOtherBean; // this will work
@Autowired
private MySpringBean mySpringBean; // dont think that this will work
....
}
Any ideas on how to make use of spring beans inside a cdi bean ? Thank you !
I've just tested the solution from this article, and so far it works fine, and i feel relieved.
Thank you !
Rick Hightower wrote a nice Extension library which supports to inject Spring beans into CDI beans and vice versa:
http://rick-hightower.blogspot.com/2011/04/cdi-and-spring-living-in-harmony.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With