• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Where to put the spring config for my ejb jar?

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I build a back end services consist of multiple EJBs, service interfaces, DAO. All classes will be built to classes folder:

build/classes

I plan to load the spring context xml from my service contructor:

public class MyCustomInterfaceService {

/**
* DAO properties
*/
private InsuranceGroupDAO insGrpDAO;
private PayorTypeDAO payorTypeDAO;
private ProductCategoryDAO prodCatDAO;
private QueueDAO queueDAO;
private ApplicationContext context;

public MyCustomInterfaceService (){
context = new ClassPathXmlApplicationContext("beans-context.xml");
BeanFactory factory = (BeanFactory) context;
insGrpDAO = (InsuranceGroupDAO)factory.getBean("insuranceGroupDao");
payorTypeDAO = (PayorTypeDAO)factory.getBean("insuranceGroupDao");
prodCatDAO = (ProductCategoryDAO)factory.getBean("insuranceGroupDao");
queueDAO = (QueueDAO)factory.getBean("insuranceGroupDao");
}

// some interface business methods here
}

Where should I place my beans-context.xml? In build/classes, and jar them together with the ejb.jar? Anyone has experience with this please help. Also, this ejb will be deployed to websphere, any comment/input for this specific app server with what I'm doing will be greatly appreciated.

I also have another war for web end that has it separate spring config under WEB-INF/ folder.

Is it correct to have two separate bean config one in the web tier and one for the ejb tier like what I do? OR can we just put all beans config to web tier (WEB-INF/application-context.xml so they got pick up by the framework without explicitly load in my service constructor class?


Thanks,
 
A sonic boom would certainly ruin a giant souffle. But this tiny ad would protect it:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic