Spring MVC 3.0 with Annotation seems like a great framework for the enterprise web development. However, the issue of performance tuning often comes up when you deal with any web applications, and I am wondering how the use of Annotations affects the strategy for improving performance. For example, would the Annotation-based validations slow down the system? Are the annotated classes, controllers, beans performing as well as those defined with the XML? Would the fact that the Annotations in Spring 3.0 MVC allow such dynamic and flexible request mappings can potentially make the performance measurement and tuning more difficult?
A:
In my opinion annotation approach must have exactly the same performance as XML approach. In both cases Spring creates some BeanFactoryPostProcessor
instances and another kinds of helper objects which use different sources of information (XML or annotations), but do exactly the same thing: update bean definitions, create proxies around beans, create some infrastructure objects and so on.
Anyway, @skaffman is right. You could try both approaches and do some profiling.
wax
2010-07-13 18:57:08
A:
Most (if not all) of the annotations (and other configurations) are handled during startup. So it doesn't have any hit on performance. (They may only slow down startup, but that should be negligible)
Bozho
2010-07-13 20:15:44