Spring4个无法执行Java8个默认方法

Spring 4 cannot execute Java 8 default methods

我已经定义了接口

public interface MyInterface {
  default void setOrder(int a){ }
  default int getOrder(){return 123;}
}

和实施

public class MyInterfaceImpl implements MyInterface {}

在我的 spring 配置文件中,我定义了以下 bean:

    <bean id="a" class="my.package.MyInterfaceImpl">
    <property name="order" value="999"/>
</bean>

当我创建 spring 上下文时出现以下错误:

Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'order' of bean class [my.package.MyInterfaceImpl]: Bean property 'order' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

我使用的是 spring 版本 4.1.6.RELEASE。所以我的问题是为什么无法执行接口 MyInterface 的默认方法 setOrder 方法?好像spring完全忽略了这样的方法。

接口中默认方法的处理将随 Spring 4.2 一起提供,因此在此之前要么使用候选版本或里程碑,要么不使用 Spring 的默认方法(https://jira.spring.io/browse/SPR-12822 or https://jira.spring.io/browse/SPR-10919 )

此问题在 Spring 4.2 中仍然存在。5.RELEASE

我在 Github 上拼凑了一个展示它的示例: https://github.com/cjbooms/spring-default-methods

并在此处用 Spring 记录了一张票: https://jira.spring.io/browse/SPR-14198