• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Common Spring context for all EJBs

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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




 
author & internet detective
Posts: 42056
926
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Igor Dvorzhak
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic