I would think that labels 1 and 2 can be combined into one. Therefore, I do not know why they are separated.
For backward compatibility reasons. Older Spring applications should continue to work, and merging tags (which were introduced in different versions of Spring) would break this by changing the default behavior.
Tags 3 and 4 seem redundant to 1 and 2.
See above. 4 tags make a little different, but complement each other. Yes, if Spring were designed from scratch, there would be fewer, but the functionality should remain separate.
Summarizing:
<context:annotation-config/> allows you to maintain annotation in context. This was added as part of Java 5 support, while Spring still supported Java 1.4.
<context:component-scan base-package="org.example" /> allows you to automatically scan and configure beans instead of using explicit declarations. This was added in Spring 2.5.
<mvc:annotation-driven /> is odd. This is not required to support the annotated controller (they work by default). What he does is actually disable the old style of the non-annotated controller, and also add support for things like JSON. This is necessary because older applications still use the old controller style.
<tx:annotation-driven> is required because Spring supports many different transaction demarcation styles, one of which is the annotation style. This is the most popular style, but by no means the only one.
source share