4.spring--xml configuration file

Source: Internet
Author: User

If you use MAVEN to build a project, spring always tries to find the XSD file locally (all versions of the XSD file already included in the Spring jar package) when the XSD file is loaded.

If not found, it will be diverted to the URL specified by the path to download.

1.spring3 configuration File Sample (Applicationcontext.xml)

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:jdbc= "Http://www.springframework.org/schema/jdbc"Xmlns:jee= "Http://www.springframework.org/schema/jee"Xmlns:tx= "Http://www.springframework.org/schema/tx"XMLNS:JPA= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/DATA/JPA"Xmlns:util= "Http://www.springframework.org/schema/util"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/ Schema/beans/spring-beans-3.2.xsd Http://www.springframework.org/schema/context http://www.springframework.org/ Schema/context/spring-context-3.2.xsd Http://www.springframework.org/schema/jdbc http://www.springframework.org/ Schema/jdbc/spring-jdbc-3.2.xsd Http://www.springframework.org/schema/jee http://www.springframework.org/schema/ Jee/spring-jee-3.2.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/ Spring-tx-3.2.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/DATA/JPA http://www.springframework.org/schema/data/jpa/ Spring-jpa-1.3.xsd Http://www.springframework.org/schema/util Http://www.springframework.org/schema/util/sprin G-util-3.2.xsd Http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/ Spring-mvc-3.2.xsd "> </Beans>

2.spring4 configuration File Sample (Applicationcontext.xml)

1) 4.0

<?XML version= "1.0" encoding= "UTF-8"?> <BeansXmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"xmlns= "Http://www.springframework.org/schema/beans"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:context= "Http://www.springframework.org/schema/context"Xmlns:tx= "Http://www.springframework.org/schema/tx"Xmlns:cache= "Http://www.springframework.org/schema/cache"xmlns:p= "http://www.springframework.org/schema/p"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-4.0.xsd HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/ Spring-aop-4.0.xsd Http://www.springframework.org/schema/context http://www.springframework.org/schema/context/ Spring-context-4.0.xsd Http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/ Spring-tx-4.0.xsd Http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/ Spring-cache-4.0.xsd ">              <!--What21cache Bean -    <Beanname= "Demo"class= "Com.what21.spring4.What21Demo">    </Bean>     </Beans>

2) 4.2

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"Xmlns:mvc= "Http://www.springframework.org/schema/mvc"Xmlns:context= "Http://www.springframework.org/schema/context"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2. XSD Http://www.springframework.org/schema/context HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/CONTEXT/SPR Ing-context-4.2.xsd Http://www.springframework.org/schema/mvc Http://www.springframework.org/schema /mvc/spring-mvc-4.2.xsd Http://www.springframework.org/schema/context http://www.springframework.or G/schema/context/spring-context-4.2.xsd "></Beans>

4.spring--xml configuration file

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.