SpringAnnotation之配置AnnotationXML文件

来源:互联网 发布:sql注入绕过 concat 0x 编辑:程序博客网 时间:2024/06/06 05:56
配置Annotation的环境:只需修改applicationContext.xml文件即可

1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    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.xsd
           http://www.springframework.org/schema/context
           http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <context:annotation-config/>
     
</beans>

增加内容:


解释:

1、<beans xmlns="http://www.springframework.org/schema/beans":表示在这个xml文件中没有任何前缀的标签,它们的schemaLocation

就去http://www.springframework.org/schema/beans这​个key下对应的那个文件去找所能写的东西

2、xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" :同样的,文件中所有以xsi为前缀的标签,都去http://www.w3.org/2001/XMLSchema-instance这个key下对应的那个文件去找所能写的东西

3、xmlns:context="http://www.springframework.org/schema/context":表示以context开头的元素<context:annotation-config/>,都从"http://www.springframework.org/schema/context"这个key下对应的那个文件去找所能写的东西





来自为知笔记(Wiz)


0 0
原创粉丝点击