LoggingAspect
클래스에 속성을 주입하는 데 문제가 있습니다.Aspect 로깅 클래스에 속성을 주입하는 방법은 무엇입니까?
public interface IBoc {
}
public class BocImpl implements IBoc {
}
및 BOC의 봄 구성 : 이것은 BOC입니다
@Aspect
public class LoggingAspect {
private IBoc theBo;
/** getter and setter **/
}
: 이미징 내가 AspectJ를 클래스가 applicationContext.xml 파일에서
<beans ...>
<aop:aspectj-autoproxy/>
<bean id="theBoc" class="org.huahsin.BocImpl"/>
</beans>
을, 나는 AspectJ의를 구성 이러한 방식으로 :
<beans...>
<bean id="theLog" class="org.huahsin.LoggingAspect">
<property name="theBo" ref="theBoc"/>
</bean>
</beans>
LoggingAspect
클래스에 theBo
을 어떻게 주입 할 수 있습니까? 2012년 10월 17일
에
가업데이트 나는 여기에 몇 가지 단서를 발견했다. <aop:aspectj-autoproxy>
을 제거하면 LoggingAspect
멤버 변수 theBo
이 null이되지 않습니다. 그 코드가 있으면 theBo는 null이됩니다.
? 내가 아는 한 제대로 작동해야합니다. – axtavt
'theBo' 여전히 null입니다. – huahsin68
@Resource 주석으로 theBo에 주석을 달고 작동하는지 알려주십시오. –