我試圖在沒有運氣的情況下使用Spring/AspectJ集成。春天的版本是3.2.17(是的,有點舊,我知道)。Spring AspectJ集成不起作用
這裏是我的相關配置:
的pom.xml:
<!-- Spring dependencies, including spring-aspects -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.7.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.7.4</version>
</dependency>
的applicationContext.xml:
<context:annotation-config/>
<aop:aspectj-autoproxy />
<bean id="loggingAspect" class="com.jason.app.web.util.logging.LoggingAspect" />
LoggingAspect.java(相關類):
@Aspect
public class LoggingAspect {
private Logger log = LoggerFactory.getLogger(LoggingAspect.class);
/**
* Advice for before logging
* @param joinPoint
*/
@Before("execution(* com.jason.app.web.process..*(..))")
private void beforeAdvice(JoinPoint joinPoint) {
final String outputFormat = "intercept: executing method %s(%s)";
final String method =joinPoint.getSignature().getName();
List<?> argumentList = Collections.unmodifiableList(Arrays.asList(joinPoint.getArgs()));
final String formattedArguments = argumentList.stream().map(s -> s.toString()).collect(Collectors.joining(", "));
log.debug(String.format(outputFormat, method, formattedArguments));
}
}
我倒了o nline教程,沒有運氣。任何人都可以指出我做錯了什麼?
傑森
由於Spring-AOP的限制,當我試圖討論與AspectJ的Spring集成時,由於主持人確信自己我想使用Spring-AOP,因此將其關閉。 謝謝你沒有人。 – Jason