报错:
Pointcut is malformed: Pointcut is not well-formed: expecting '(' at character position 0
源码:
package me.zxw135136.novelWeb.log;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;
@Component
@Aspect
public class LogAspect {
@Pointcut("execution(* me.zxw135136.novelWeb.service..*(..))")
private void pointCut() {}
@Around("pointCut")
public Object logAround(ProceedingJoinPoint jointPoint) throws Throwable {
System.out.println(jointPoint+"开始");
Object proceed = jointPoint.proceed();
System.out.println(jointPoint+"结束");
return proceed;
}
}
解决方法:
@Around等注解中的方法需要加括号
@Around("pointCut()")