cglib dynamic proxy, why does a () call the b (), of the current class this b () is the b (), of the parent class and not the b () of the subclass generated by cglib?
@Component
public class MyTest {
public void a() {
System.out.println("it"s a");
b();
}
public void b() {
System.out.println("it"s b");
}
}
@Aspect
@Component
@Slf4j
@Getter
public class AspectLog {
@Pointcut("execution(public * com.vae1970.demo.aspect.MyTest.*(..))")
public void pointcut() {
}
@Before("pointcut()")
public void before(JoinPoint jp) {
Method method = (MethodSignature) jp.getSignature().getMethod();
System.out.println("log: function " + method.getName());
}
}
@RestController
public class TestController {
@Autowired
private MyTest myTest;
@GetMapping("/aspect")
public String aspect() {
myTest.a();
return "ok";
}
}
expected output
log: function a
it"s a
log: function b
it"s b
actual output
log: function a
it"s a
it"s b
I looked at the MyTest classes generated by cglib, both, a () and b () are proxies, so why didn"t the b () of the proxy classes be executed when actually executed?