Java 弹簧@自动接线

Java 弹簧@自动接线,java,spring,spring-mvc,Java,Spring,Spring Mvc,使用@autowired。在xml中,我只需要包含 我还需要贴其他标签吗?需要进行组件网扫描吗 奇怪,下面有个错误 ERROR - ContextLoader.initWebApplicationContext(203) | Context initialization fa iled org.springframework.beans.factory.BeanCreationException: Error creating bean wit h name 'org.springframew

使用@autowired。在xml中,我只需要包含

我还需要贴其他标签吗?需要进行组件网扫描吗

奇怪,下面有个错误

ERROR - ContextLoader.initWebApplicationContext(203) | Context initialization fa
iled
org.springframework.beans.factory.BeanCreationException: Error creating bean wit
h name 'org.springframework.context.annotation.internalRequiredAnnotationProcess
or': Initialization of bean failed; nested exception is org.springframework.bean
s.InvalidPropertyException: Invalid property 'order' of bean class [org.springfr
amework.beans.factory.annotation.RequiredAnnotationBeanPostProcessor]: No proper
ty 'order' found
Caused by:
org.springframework.beans.InvalidPropertyException: Invalid property 'order' of
bean class [org.springframework.beans.factory.annotation.RequiredAnnotationBeanP
ostProcessor]: No property 'order' found
        at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrap
perImpl.java:376)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1105)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:861)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBean

这看起来像是类路径问题。您是否混合了不同Spring JAR的不兼容版本,或者在您的类路径上是否有多个
RequiredAnnotationBeanPostProcessor

该类的早期版本(2.0.x之前)没有order属性。

Spring 2.5中引入了
选项。在封面下,这将创建和配置一个
required注释BeanPostProcessor
,并使用该处理器的
order
属性。在Spring2.0中,
RequiredAnnotationBeanPostProcessor
存在,但没有
order
属性


我的猜测是,Spring2.5和2.0都在您的类路径上。2.5的副本本来允许您使用
,但随后它将2.0副本用于
所需的注释BeanPostProcessor

可能无论如何都应该使用3.0.x。