Annotation-based container configuration
- Are annotations better then XML for configuring Spring?
+ Are annotations better than XML for configuring Spring?
- The introduction of annotation based configurations raised the
- question of whether this approach is better or not then XML. The short
- answer is it depends.. The long answer is that each
- approach has it's pros and cons and usually it's up to the developer to
+ The introduction of annotation-based configurations raised the
+ question of whether this approach is 'better' than XML. The short
+ answer is it depends. The long answer is that each
+ approach has its pros and cons, and usually it is up to the developer to
decide which strategy suits her better. Due to the way they are defined,
- annotations provide a lot of context in their declaration leading to
- shorter, more concise configurations. However XML excels at wiring up
- components without touching their source code or recompile them. Some
- prefer having the wiring close to the source while others argue that
- annotated classes are no longer POJOs and further more that the
- configuration becomes decentralized and harder to control.
+ annotations provide a lot of context in their declaration, leading to
+ shorter and more concise configuration. However, XML excels at wiring up
+ components without touching their source code or recompiling them. Some
+ developers prefer having the wiring close to the source while others
+ argue that annotated classes are no longer POJOs and, furthermore, that
+ the configuration becomes decentralized and harder to control.No matter the choice, Spring can accommodate both styles and even
mix them together. It's worth pointing out that through its