-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GatewayProxyFactoryBean should not proxy default methods in the interface #3118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
Milestone
Comments
The
The code in Java 8 is like this:
|
Well, we definitely have to fix at least proxiing extra non-abstract methods. Otherwise Integration Graph becomes a bit awkward:
|
artembilan
added a commit
to artembilan/spring-integration
that referenced
this issue
Dec 11, 2019
artembilan
added a commit
to artembilan/spring-integration
that referenced
this issue
Dec 11, 2019
Fixes spring-projects#3118 The `GatewayProxyFactoryBean` proxies all the methods in the provided interface, including `default` and `static`. This is not what is expected from end-users. * Proxy only `abstract` methods from the provided interface * Introduce a `DefaultMethodInvokingMethodInterceptor` to call `default` method on the interface using a `MethodHandle` approach for those methods calling
artembilan
added a commit
to artembilan/spring-integration
that referenced
this issue
Dec 11, 2019
Fixes spring-projects#3118 The `GatewayProxyFactoryBean` proxies all the methods in the provided interface, including `default` and `static`. This is not what is expected from end-users. * Proxy only `abstract` methods from the provided interface * Introduce a `DefaultMethodInvokingMethodInterceptor` to call `default` method on the interface using a `MethodHandle` approach for those methods calling
artembilan
added a commit
to artembilan/spring-integration
that referenced
this issue
Dec 13, 2019
Fixes spring-projects#3118 The `GatewayProxyFactoryBean` proxies all the methods in the provided interface, including `default` and `static`. This is not what is expected from end-users. * Proxy only `abstract` methods from the provided interface * Introduce a `DefaultMethodInvokingMethodInterceptor` to call `default` method on the interface using a `MethodHandle` approach for those methods calling
garyrussell
pushed a commit
that referenced
this issue
Dec 17, 2019
* GH-3118: MessagingGW: Don't proxy default methods Fixes #3118 The `GatewayProxyFactoryBean` proxies all the methods in the provided interface, including `default` and `static`. This is not what is expected from end-users. * Proxy only `abstract` methods from the provided interface * Introduce a `DefaultMethodInvokingMethodInterceptor` to call `default` method on the interface using a `MethodHandle` approach for those methods calling * * Introduce a `proxyDefaultMethods` option to let to restore a previous behavior * Handle a new property from XML, annotations & DSL configurations * Ensure that the property works in various tests * Document the feature * * Fix typo in the `build.gradle`
Hm. GitHub somehow didn't close the issue automatically with the commit. |
artembilan
added a commit
that referenced
this issue
Dec 26, 2019
* GH-3118: MessagingGW: Don't proxy default methods Fixes #3118 The `GatewayProxyFactoryBean` proxies all the methods in the provided interface, including `default` and `static`. This is not what is expected from end-users. * Proxy only `abstract` methods from the provided interface * Introduce a `DefaultMethodInvokingMethodInterceptor` to call `default` method on the interface using a `MethodHandle` approach for those methods calling * * Introduce a `proxyDefaultMethods` option to let to restore a previous behavior * Handle a new property from XML, annotations & DSL configurations * Ensure that the property works in various tests * Document the feature * * Fix typo in the `build.gradle`
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
So, we definitely would like to use
default
methods in the interface as well, but it turns out they are proxied as well leading to unexpected behavior when we don't call a realdefault
method, but send a message downstream instead.On the other hand it is not so easy to exclude those methods from proxing and their normal logic:
When a
default
method in called we have atarget
for reflection asnull
leading to NPE.Spring Data has something like this
DefaultMethodInvokingMethodInterceptor
- need to investigate what is the beast.The text was updated successfully, but these errors were encountered: