I am having trouble injecting a property into LoggingAspect
class. Imaging I have an AspectJ class:
@Aspect
public class LoggingAspect {
private IBoc theBo;
/** getter and setter **/
}
This is the BOC:
public interface IBoc {
}
public class BocImpl implements IBoc {
}
and the Spring configuration for BOC:
<beans ...>
<aop:aspectj-autoproxy/>
<bean id="theBoc" class="org.huahsin.BocImpl"/>
</beans>
In applicationContext.xml file, I configure the AspectJ in this way:
<beans...>
<bean id="theLog" class="org.huahsin.LoggingAspect">
<property name="theBo" ref="theBoc"/>
</bean>
</beans>
How could I inject theBo
in LoggingAspect
class?
Update on 17 Oct 2012
I found some clue here. If I remove the <aop:aspectj-autoproxy>
, the member variable theBo
in class LoggingAspect
will not be null. If I have that code, theBo will be null.