我现在已经在这里提出过这个问题,但我确实尝试过使用这些讨论,但没有一个对我有用。
基本上,我收到了“元素“context:annotation-config”的前缀“context”未绑定(bind)”错误,我使用 @Autowired 来排除 beans xml 中属性元素的使用。
这是我的 xml 文件的标签
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/>
自动注册 AutowiredAnnotationBeanProcessor
问题可能是由于类路径中缺少 jar 导致无法在命名空间和 spring jar 之间进行映射吗?这是外部 jar
org.springframework.aop-3.1.0.M2
org.springframework.asm-3.1.0.M2
org.springframework.beans-3.1.0.M2
org.springframework.context.support-3.1.0.M2
org.springframework.context-3.1.0.M2
org.springframework.core-3.1.0.M2
org.springframework.expression-3.1.0.M2
spring-context-3.0.6
spring-beans-3.0.6
commons-logging-1.1.1
最佳答案
您缺少的是 namespace 前缀声明:
<beans xmlns:context="http://www.springframework.org/schema/context">
关于java - 无法在 Spring 中 Autowiring ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19725184/