Skip to content

Conversation

@injae-kim
Copy link
Contributor

Closes gh-28495

Motivation

@HttpExchange("http://localhost:8080")
public interface GreetingClient {

    @GetExchange("/greeting")
    Flux<Greeting> greetings();

    default Flux<Greeting> defaultMethod() {
        return greetings(new Greeting("default method test"))
                .flatMapMany(it -> greetings());
    }
}

In JDK dynamic proxies created by Spring AOP, .. we cound make it(support default method) easier via a utility.

Modification

  • Add ReflectiveMethodInvocationUtils#invokeDefaultMethod
  • Replace duplicated default method invocation code on HttpServiceProxyFactory and RSocketServiceProxyFactory

Result

@jhoeller
Copy link
Contributor

jhoeller commented Feb 6, 2024

On review, I don't really see a need for extracting common logic there since it is a pretty straight invocation anyway, just a condition and a cast but then being able to return straight away.

From where we stand right now, #28495 is rather about where else to invoke default methods the same way. If we identify such further places, I don't mind copying the same condition logic there.

@jhoeller jhoeller closed this Feb 6, 2024
@jhoeller jhoeller added status: declined A suggestion or change that we don't feel we should currently apply in: core Issues in core modules (aop, beans, core, context, expression) and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Feb 6, 2024
@injae-kim
Copy link
Contributor Author

rather about where else to invoke default methods the same way. If we identify such further places, I don't mind copying the same condition logic there.

Aha~ I understood. I think #28495 means extracting common logic 😅

Thanks you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply

3 participants