SpringAnnotation之配置AnnotationXML文件

配置Annotation的环境:只需修改applicationContext.xml文件即可

1
2
3
4
5
6
7
8
9
10
11
<?xml version="1.0" encoding="UTF-8"?>
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    <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下对应的那个文件去找所能写的东西







posted @ 2015-08-27 09:32  Python魔法师  阅读(648)  评论(0编辑  收藏  举报