Analysis of spring-related configuration instantiation in web containers, webspring

Source: Internet
Author: User

Analysis of spring-related configuration instantiation in web containers, webspring

This article briefly introduces the configuration of instantiating spring in web containers. Next, let's take a look at the specific content.

Configuration instructions for instantiating spring in web containers:

To load the spring container when the web container is instantiated, configure the following in the web. xml file:

<Context-param> <param-name> contextConfigLocation </param-name> <param-value> classpath: bean. xml </param-value> </context-param> <! -- Instantiate the listener s for the Spring container --> <listener-class> org. springframework. web. context. ContextLoaderListener </listener-class> </listener>

Note:

By default, the applicationContext. xml under/WEB-INF/is loaded during spring instantiation.

<Param-name> contextConfigLocation </param-name>

<Param-value> classpath: bean. xml </param-value> specifies the file to be loaded by spring (the bean. xml file under the class path)

If the configuration file has multiple configurations:

  <context-param>    <param-name>contextConfigLocation</param-name>    <param-value>      classpath*:conf/spring/applicationContext_core*.xml,      classpath*:conf/spring/applicationContext_dict*.xml,      classpath*:conf/spring/applicationContext_hibernate.xml,      classpath*:conf/spring/applicationContext_staff*.xml,      classpath*:conf/spring/applicationContext_security.xml      classpath*:conf/spring/applicationContext_modules*.xml      classpath*:conf/spring/applicationContext_cti*.xml      classpath*:conf/spring/applicationContext_apm*.xml    </param-value>  </context-param>

Or (use spaces to separate them, as shown below :)

     <CONTEXT-PARAM>     <PARAM-NAME>contextConfigLocation</PARAM-NAME>     <PARAM-VALUE>        applicationContext-database.xml applicationContext.xml     </PARAM-VALUE>    </CONTEXT-PARAM>

Summary

The above is all about parsing spring-related configuration instantiation in web containers. I hope it will be helpful to you. Interested friends can continue to refer to this site:

Code explanation of Spring bean instantiation Method"

Spring instance factory method and static factory Method Instance code"

Differences Between Spring Singleton Bean and Singleton Mode"

If you have any shortcomings, please leave a message. Thank you for your support!

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.