Spring and CDI Injection

Good evening,
I'm having a problem while trying to set up a test environment using Arquillian and weld and a lot of stuff.
Conceptually I believe the problem I'm facing, and actually the answer I'm not seeing is related to spring and CDI injection, which likely I do not have all the knowledge (otherwise I wouldn't be facing this problem.)
My question is , I can in a web application (or web service) running inside a J6EE container, access the annotated or the spring-applicationContext.xml defined classes when they are inside a jar included in my WEB-INF/lib ?
I believe that the picture will make easier to ask and understand my question.
Basically I would like to inject into my main application a class that is contained in a jar with applicationContext.xml. Also this bean has dependence on a third class which is in the same applicationContext.xml.
Would someone has any clue on the standard behavior in this case?
Would I need to define again a applicationContext.xml in my war application?
Thank you you all,
Miguel

So, you want to inject your Spring bean into a CDI injected class? I think, at this time, there is no native way of doing this (although I might be wrong), but someone has implemented a Spring to CDI bridge that you can use to inject Spring beans to CDI beans and CDI beans into Spring beans. Look here

Miguel Garz

Greenhorn

Posts: 2

posted 6 years ago

Well, basicallty I would like to use CDI (or Spring) classes from other Jars. in this example I gave, my web application is the "Application war" that needs classes in the "Jar3" and in the "jar1". In this case should I redefine the spring mapings in my application? Actually I'm trying to test a application in a j6ee container, but despite the application works, the container can't find the classes that are defined in the applicationContext, just the ones are annotated...

That's a very big dog. I think I want to go home now and hug this tiny ad: