Java8 dynamic proxy and default methods

后端 未结 4 1224
北荒
北荒 2021-01-01 20:43

Having a dynamic proxy for an interface with default methods, how do I invoke a default method? By using something like defaultmethod.invoke(this, ...) you just

4条回答
  •  -上瘾入骨i
    2021-01-01 21:07

    I wrote up a blog entry detailing the different approaches that must be used for Java 8 and 9+: http://netomi.github.io/2020/04/17/default-methods.html

    It includes code from the spring framework to handle the different cases in a clean and efficient way.

提交回复
热议问题