PDA

View Full Version : How many appcontext can have an application?


carlos.montoya
03-28-2007, 03:27 PM
Hello,

I decided to use spring in my current project, I have many objects configuration files and currently I create a new application context to each one. So, at this moment the application is working without problems but I need to be sure if this is the best practice o if I need to do the things in other way such have only one application context.

I use this call around five times with different objects files in the same application: springAppContext = new XmlApplicationContext(springFile);

Sorry about my english but my native languaje is spanish
Thanks

Nop
03-29-2007, 06:38 AM
Hi carlos.montoya.
I did not look for upper limit for the spring context number, but I think that you can create as many contexts as you want.
I think that the number of contexts depends of the architecture of your application. For example, using multiple contexts allows to separate objects of one context from another... In my practice I use only one context.

Best regards,
Nop

Aleks Seovic
03-30-2007, 07:45 PM
Yes, you can use as many contexts as you need to cleanly separate your application's objects.

However, in most applications you will have one root context containing shared objects and possibly one or more child contexts for various self-contained components.

- Aleks