creating one session factory from two or more applicationContext files having their own POJO list
posted 5 years ago
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.
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.