File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes Common Spring context for all EJBs Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Application Frameworks » Spring
Reply Bookmark "Common Spring context for all EJBs" Watch "Common Spring context for all EJBs" New topic
Author

Common Spring context for all EJBs

Igor Dvorzhak
Greenhorn

Joined: Jul 23, 2010
Posts: 6
I have four EJBs in my application which act as services

With help of Spring I am provide dependency injection of DAOs into the beans

But Weblogic initialized four Spring context: one per each EJB

Is there possibility to initialize one Spring context for all EJBs

P.S sorry for my English

ejb-jar.xml




Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 23635

Igor,
Welcome to JavaRanch!

All of your EJBs point to a different Spring config xml file. How would they share the same Spring context if they are containing different sets of beans?

If you merge the xml files into one, at least it becomes logically possible to share a context. The Pro Spring article says the default is a different app context per ejb, but:
If this behavior is undesirable for your application, then Spring provides the SingletonBeanFactoryLocator and ContextSingletonBeanFactoryLocator classes that load singleton instances of BeanFactory and ApplicationContext, respectively. For more information, see the Javadoc for these classes


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Certs: SCEA Part 1, Part 2 & 3 & Core Spring 3, OCAJP
Igor Dvorzhak
Greenhorn

Joined: Jul 23, 2010
Posts: 6
Thanks, it really help me

To provide single context for all EJBs I use ContextSingletonBeanFactoryLocator instead of the default ContextJndiBeanFactoryLocator, as described in the Spring documentation
 
jQuery in Action, 2nd edition
 
subject: Common Spring context for all EJBs
 
Threads others viewed
weblogic.appc giving error while creating jar from ant with weblogic10.0 jars
Jboss + Spring + Ejb (Null Pointer Exception Problem)
Error creating bean with name 'manager';def nested exception is javax.naming.NameNotFoundException:
env-entry tag
EJB JNDI name
IntelliJ Java IDE

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture