Nov 5th, 2006, 10:38 AM
xml spring context files, package extructure and performance
I have a great doubt about how i most organize my xml context definitions in my spring web application.
I have a package extructure like this i show below:
Now the xml contexts where will be the bean declaration for all the classes include in those packages under the Module are in a central place in WEB-INF\. This approach hinder several tests where i most to load the spring context, for instance test to my spring manage transaction beans. Beside this approach is not convenient if i want to pack in a jar file for example one module, because the beans declared in the spring context are not inside the module but under WEB-INF and spread across the severals xml contexts, because the organization criteria of bean declaration in the xml contexts is not the same of the package extructure for this approach.
I can to dedicate a xml spring context to declare all the service beans without caring of what module they belong.
In this approach with a few xml spring context files i resolve all my application.
All rigth there are a solution, to include a package under every module where i put a xml spring context with the bean declarations relative to the module, just like this:
--------I__web presentation javaBeans
--------I__domain bussiness classes
--------I__facade module funtionality tha is used by the presentation beans
--------I__service methods to be exposed to external sistems, like web services for example
--------I__config xml spring context files for bean declarations of the module
This approach solve all the dificulties i mention above, but my doubt is about the performance. With this approach the number of xml spring context files is much bigger (so many xml context files like modules have the application), and spring container have to read and parse all of then.
My question is:
The performance of a spring application is afected when the number of xml context files is big?
Last edited by maykell; Nov 5th, 2006 at 10:48 AM.
Nov 5th, 2006, 06:29 PM
Unless you are using the new web-scoped beans from Spring 2.0 (request and session beans), or using SpringMVC, *no* Spring framework code in general will execute at runtime for your app. Therefore the runtime performance of your application will be entirely unaffected by the way you structure your configuration files.
Originally Posted by maykell
Typically Spring takes a few tens of milliseconds at startup parsing your configuration files and instantiating the container (not including class loading costs from the JVM).