Description of the Spring configuration file header file

Source: Internet
Author: User

<?XML version= "1.0" encoding= "UTF-8"?><Beansxmlns= "Http://www.springframework.org/schema/beans"Xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"XMLNS:AOP= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"Xmlns:tx= "Http://www.springframework.org/schema/tx"Xmlns:context= "Http://www.springframework.org/schema/context"xsi:schemalocation= "Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/ Spring-beans-3.0.xsdhttp://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/ SPRING-TX-3.0.XSDHTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP http://www.springframework.org/schema/aop/ Spring-aop-3.0.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/ Spring-context-3.0.xsd "></Beans>

This has not been understood, the search today, to find an explanation, is not a good explanation of my question. I want to add!

XML Schema namespace function:
1. Avoid naming conflicts, like the package in Java

2. Classify labels with different roles (the TX namespace in spring, for the label of the transaction class, the context namespace for the label of the component)

Code Explanation:
1, xmlns= "Http://www.springframework.org/schema/beans"
Declares the default namespace for the XML file, which represents the default namespace for all labels that do not use other namespaces.

2, xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance"
Declares an XML Schema instance that can be declared to use the SchemaLocation property.

3, xmlns:aop= "HTTP://WWW.SPRINGFRAMEWORK.ORG/SCHEMA/AOP"
Declares a namespace with a prefix of AOP, and subsequent URLs that are used to indicate namespaces are not used by the parser to find information. Its only function is to give the namespace a unique name. When a namespace is defined in the start tag of an element, all child elements with the same prefix are associated with the same namespace.

4, xsi:schemalocation= "
Http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
This can be seen from the name of a general, the location of the specified schema this property must be used in conjunction with the namespace. This property has two values, and the first value represents the namespace that needs to be used. The second value represents the location of the XML schema for use by the namespace

So what kind of tags do we need when we introduce what namespaces and schema definitions are available.

http://iswift.iteye.com/blog/1657537

Description of the Spring configuration file header 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.