• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

Spring and CDI Injection  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Question-about-CDI.png
[Thumbnail for Question-about-CDI.png]
UML Model of what I'm trying to do.
 
Rancher
Posts: 2759
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!