I suddenly learned this thing and found this book.
Struts 2.21 spring 2.5.6 configure IOC or something through annotation.
1. Struts basic configuration, also remember to add struts2-spring-plugin-2.2.1.1.jar this package
2. Spring requires spring. jar, Jakarta-commons, log4j, and log4j.
3. In web. xml
<Context-param>
<Param-Name> contextconfiglocation </param-Name>
<Param-value> classpath: COM/ssh/spring/*. xml </param-value>
</Context-param>
<! -- Register the spring listener -->
<Listener>
<Listener-class>
Org. springframework. Web. Context. contextloaderlistener
</Listener-class>
</Listener>
In order to modify the loading location of the spring configuration file, contextconfiglocation is the search parameter, and the value is placed in the path
4. In the spring configuration file
<Context: component-scan base-package = "com. Ssh"/>
Enable annotation support. com. SSH is the name of the supported package range, and all the sub-packages under it can be annotated.