Skip to content

[Bug] The CreateAopProxyInterceptor in the Spring core-patch indeed changes the implementation of the Spring AOP proxy. #12858

@youjie23

Description

@youjie23

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

  1. Create a project using Spring Boot (version 2.0.8.RELEASE) and Spring MVC (version 5.0.12.RELEASE).
  2. Define an interface with a method that includes the @RequestBody annotation.
  3. 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?

Code of Conduct

Metadata

Metadata

Assignees

Labels

agentLanguage agent related.bugSomething isn't working and you are sure it's a bug!javaJava agent related

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions