Simple spring configuration in SSH

Source: Internet
Author: User

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.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.