@Cesar
2016-01-05T09:31:37.000000Z
字数 1072
阅读 1820
Spring
Java
学习
The prefix "context" for element "context:annotation-config" is not bound.
该错误原因是没有引入context的空间,只需要在
< beans xmlns="http://www.springframework.org/schema/beans"
后面加上一行变为:
< beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
就可以了
在xsi后面加上两个地址:
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd"
就可以了
最后将总的配置文件发布一下:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd"
>
<context:annotation-config></context:annotation-config><!--这个代表着允许使用注解进行装配-->
</beans>