As far as XML vs Annotation, why not use both? I don't quite get why people trying to stay on one side. This is my philosophy when choosing XML vs Annotation.
XML
Any configuration that is likely to change. For example, datasource.
Annotation
Any configuration that is least likely to change.
Very good summary.
I have a feeling that annotations are pushed forward by people who either have XML phobia, or have crappy IDEs. Spring support in IDEA is superb, and I have never had any problems dealing with huge Spring XML descriptors.
To cope with ever-growing context descriptors, we tend to split large Spring XML context files into smaller chunks and then we have a 'bootstrap' context file that imports all the smaller ones.
To me, the main disadvantage of annotations is that they are often equivalent to hard-coding. They are compiled into java classes and you are doomed if you want to change your wirings or configuration after the compilation phase.
XML configuration is external to compiled binaries, it keeps all wirings and configuration in one place, it is still there in the same format in the assembled project, and it can be easily modified in an emergency situation.
Annotations are intrusive, they often create additional compile-time and runtime dependencies, they are scattered all over the place. Once compiled, annotations and java-based configuration cannot be easily viewed without decompilation or tracing back to the original code.
We had a brief foray into annotation-based configuration, but eventually had to revert anything but @PostConstruct/@PreDestroy and Spring-JMX annotations.
Interesting. Just testing this new comment response screen.