candyleer commented on issue #3035: NPE Aspect URL: https://github.com/apache/skywalking/issues/3035#issuecomment-510539321 Actually, this is a complex problem. 1.the controller method modifier is `private` which is not recommend for controller, without skywalking agent it is working just because an accident, you can try add a `public` method in the controller ,you will see the `goodsExternalService ` is always `null` in private method. 1.1 why the `goodsExternalService ` is always `null` in private method if add another `public` method? the reason is the controller is enhanced by cglib in spring ,in enhanced classes ,private method cannot get `goodsExternalService` 1.2 why it can work in current version? the reason is the controller just have a method and is `private` and it is not match the `ascpect expression `,so the controller will not be enhanced by cglib in spring . 2.why with skywalking agent it doesn't work? the reason is is have implement an interface `EnhanceInstance` and it have two default method `getSkywalkingField` and `setSkywalkingField` which modifier is `public` ,this match the aspect expression.so the controller will enhanced by cglib in spring . 3.conclusion If the class is enhanced by cglib in spring .all `private` method will get `goodsExternalService` by null.  
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
