Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Rahul Babbar
Ranch Hand
Posts: 210
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic