aspose file tools*
The moose likes Spring and the fly likes creating one session factory from two or more applicationContext files having their own POJO list Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "creating one session factory from two or more applicationContext files having their own POJO list" Watch "creating one session factory from two or more applicationContext files having their own POJO list" New topic
Author

creating one session factory from two or more applicationContext files having their own POJO list

Rahul Babbar
Ranch Hand

Joined: Jun 28, 2008
Posts: 210
Hi.

I have two applicationContext files coming from two different sources(jars)...and each of them have their applicationContext, and having declaration of sessionFactory.
But when i read both these applicationContexts i want to create a single instance of SessionFactory.

The problem is in automatic merging of lists of two files.

Here is the portion of applicationContext-A.xml



ApplicationContext-B.xml



What is required is



Can anyone explain how to accomplish this?

Thank you

Rahul Babbar
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Well the instance of SessionFactory will be stored in a map, under the key "sessionFactory" so if you have more than one bean definition with the same id, but in different files, the last one read in wins. So this means that you can overwrite the other two definitions with yours, as long as you make sure yours is the last xml file read in.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating one session factory from two or more applicationContext files having their own POJO list