-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Search before asking
- I had searched in the issues and found no similar issues.
Apache SkyWalking Component
Java Agent (apache/skywalking-java)
What happened
Without being enhanced by the SkyWalking agent, beans that implement the UserSuppliedInterface
are proxied by JdkDynamicAopProxy
and work correctly.
However, when enhanced by the SkyWalking agent, these beans are instead proxied by ObjenesisCglibAopProxy
(due to changes made by CreateAopProxyInterceptor
). This change in proxy mechanism introduces several issues, such as exceptions being thrown.
What you expected to happen
The behavior of the application when enhanced by the SkyWalking agent should remain consistent with its behavior before enhancement.
As discussed in issue #581, we agree with this principle. However, the CreateAopProxyInterceptor
did not function as expected to ensure this consistency.
How to reproduce
- Create a project using Spring Boot (version 2.0.8.RELEASE) and Spring MVC (version 5.0.12.RELEASE).
- Define an interface with a method that includes the
@RequestBody
annotation. - Create a
@RestController
class that implements the previously defined interface, but does not include the@RequestBody
annotation in its method.
codes like
@RequestMapping("/")
public interface DemoApi{
@PostMapping("/demo")
Boolean createIntroduction(@NotNull @Valid @RequestBody DemoVo params);
}
@RestController
@Validated
@RequestMapping("/")
public class DemoController implements DemoApi {
@Override
@PostMapping("/demo")
public Boolean demoMethod(DemoVo params) {
}
}
The implementation of the AOP proxy impacts the processing of annotations like @Valid
and @RequestBody
within the demoMethod
. Consequently, this prevents the proper population of field values in the method parameters, leading to all fields being null
.
Anything else
No response
Are you willing to submit a pull request to fix on your own?
- Yes I am willing to submit a pull request on my own!
Fix CreateAopProxyInterceptor in the Spring core-patch indeed changes the implementation of the Spring AOP proxy skywalking-java#739
Code of Conduct
- I agree to follow this project's Code of Conduct