This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Object injection to EJB using Spring

 
John Groller
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand enough to even ask the question coherently, but here it goes...

Here at work, we are required to use Spring to "inject" our objects into our Stateless Session Beans. We have a base class in our internal framework that we are supposed to extend for all beans that are "configurable using Spring".

I'm familiar with the configuration xml file, and how you list out all the beans in it... but I'm having trouble connecting the dots.

A "Hello World!" type explanation for this would be perfect.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, I would suggest looking at that base class. Does it just hold a reference to the ApplicationContext and you are then required to call getBeans() on it yourself to access your Spring Beans. This is probably the implementation. And it probably would be best in the EJB lifecycle method that gets called when the EJB instance is first created. So most likely ejbCreate.

But know that the way you do this is specific to your company and whoever implemented your companies base class, and this is not a Spring class that you are extending, based on what you posted.

Spring does have an AbstractStatelessSessionBean class that you can extend, but it doesn't sound like you guys decided to go that architect/design route. Let us know if it is otherwise.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic