2009-10-15 3 views
1

@autowired를 사용하십시오. xml에 포함하면됩니다.스프링 @autowired

<context:annotation-config />?

다른 태그를 추가해야합니까? componetet-scan을 입력해야합니까?

이상한, 난 오류가

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 

답변

2

<context:annotation-config /> 옵션은 Spring 2.5에서 소개되었습니다. 이 문제를 해결하기 위해 RequiredAnnotationBeanPostProcessor을 만들고 구성한 다음 order 속성을 사용합니다. Spring 2.0에서는 RequiredAnnotationBeanPostProcessor이 존재하지만 order 속성은 없습니다.

내 생각 엔 클래스 패스에 Spring 2.5와 2.0이 둘 다 있다는 것입니다. 2.5의 사본은 <context:annotation-config />을 사용할 수 있었지만 RequiredAnnotationBeanPostProcessor의 경우 2.0 사본을 사용했습니다.

+0

아마 3.0.x를 사용해야합니다. – Tony

1

다음은이 클래스 경로 문제처럼 보인다 얻을. 서로 다른 Spring jar의 호환되지 않는 버전을 혼합하거나 클래스 경로에 복수 RequiredAnnotationBeanPostProcessor 클래스가 있습니까?

해당 클래스의 이전 버전 (최대 2.0.x)에는 주문 속성이 없었습니다.

관련 문제