Hi
Why would you choose to use a hierarchical application context over just initializing a single application context from multiple resource files (e.g. XML files)?
Still very new to Spring so forgive me if this is an obvious question. Plus I've been doing lots of reading in earlier threads about setting up hierarchical contexts etc and my bucket is somewhat full - so I'm probably just missing an obvious point.
The background to the question is that I'm building a fairly modular Eclipse RCP app and I was looking to utilize Spring to get some IOC value in there.
The modules follow a relatively well defined hierarchy with modules lower down re-using capability from modules higher up. In particular, the DAO classes of the leaf modules will need to 'inherit' JPA configuration in a core module.
When it comes to setting up the application context I think I could go two ways:
1. Have one application context in the core module that is loaded with XML files from lower down modules. The lower down module would contribute their configuration resources to the core module.
2. Have a core application context and have each module create their own application context which sets the core context as a parent.
Possibly I might run into class loader issues with (1) if the core module cannot see the leaf module classes (which might answer my question - but there are probably ways around that in Eclipse).
So what's the benefit of one approach over another?
Thanks
Martin


Reply With Quote
