Spring MVC 3.0 with Annotation seems like a great framework for the enterprise web development. However, the issue of performance tuning o开发者_如何学JAVAften 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?
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.
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)
精彩评论