我无法@Autowire在Aspect中使用服务层实例.在Aspect中,对@Autowiredbean 的引用是NULL并且它会抛出NullPointerException.任何帮助都感激不尽.我想,我搞砸了配置.
以下是我的servlet-context.xml:
<!-- Activates various annotations to be detected in bean classes -->
<context:annotation-config />
<context:spring-configured />
<!-- Scans the classpath of this application for @Components to deploy as beans -->
<context:component-scan base-package="xx.yy" />
<!-- an @AspectJ aspect will be interpreted as an aspect by Spring AOP and beans in the context will be advised accordingly -->
<aop:aspectj-autoproxy />
<beans:bean id="loggingAspect" class="xx.yy.aop.aspects.LoggingAspect" />
<beans:bean id="authenticationAspect" class="xx.yy.aop.aspects.AuthenticationAspect" />
<!-- Enables the Spring …Run Code Online (Sandbox Code Playgroud)