@Component
@Aspect
@Slf4j(topic = "e")
public class NotVeryUsefulAspect{
@Pointcut("within(com.lc.aop.for_source.service.impl.AAopServiceImpl)")
public void pointCutWithinAAopService(){
}
@Pointcut("@within(com.lc.aop.for_source.service.XAnnotation)")
public void pointCutAnnotation(){
}
@Before("pointCutWithinAAopService()")
@Order(0)
public void adviceBeforeAAopService(){
log.debug("=======before aop service========");
}
@Before("pointCutAnnotation()")
@Order(-1)
public void adviceBeforeAAopService2(){
log.debug("=======before aop annotation========");
}
}
@Slf4j(topic = "e")
@Component("a")
@XAnnotation
public class AAopServiceImpl implements AopService {
@Override
public void m() {
log.debug("a -AAopServiceImpl");
}
}
Based on the advice-ordering
Consider collapsing such advice methods into one advice method per join point in each @Aspect class or refactor the pieces of advice into separate @Aspect classes that you can order at the aspect level via Ordered or @Order.
Do I understand correctly that the @Order
does not work in this case? Why not suport the method level order?
I think this is a very simple function, but it can avoid some unnecessary misunderstandings about @Order
I would like to order advice by method level.