- Notifications
You must be signed in to change notification settings - Fork 38.9k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regressionA bug that is also a regression
Milestone
Description
When I saw the AOP source code, I found that the getAdvisorMethods method in ReflectiveAspectJAdvisorFactory introspects the methods of Object, and I am confused about this.
The sample as follow,
@Aspect @EnableAspectJAutoProxy @Slf4j public class AopConfig { @Around("execution(* cn.hiboot.framework.research.spring.research.SimpleStart.*(..))") public Object around(ProceedingJoinPoint p) throws Throwable { log.info("proceed before"); Object obj = p.proceed(); log.info("proceed after); return obj; } }@Slf4j @Import(AopConfig.class) public class SimpleStart { public SimpleStart() { log.info("execute constructor"); } public String test(){ return "test method return value"; } } @Test public void research(){ AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(SimpleStart.class); SimpleStart bean = context.getBean(SimpleStart.class); bean.test(); }When a superclass is Object, it continues recursively, because in ReflectiveAspectJAdvisorFactory.adviceMethodFilter the mf = ReflectionUtils.USER_DECLARED_METHODS.and(method -> (AnnotationUtils.getAnnotation(method, Pointcut.class) == null)).
The source code position:
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regressionA bug that is also a regression