Spring 创建 bean 属性 迁移到 jre 1.8 时出现不可写异常

Spring bean creation property not writable exception while migrating to jre 1.8

我在创建 HazelCast 的 bean 时遇到以下异常。当我将已安装的 JRE 版本更改为 jre 1.8 时会发生这种情况。但是在 jre 1.6 中我们没有得到错误。是否对 jre 8 进行了任何更改以禁止使用此类配置。

错误:

Invalid property 'name' of bean class [com.hazelcast.config.TopicConfig]: Bean property 'name' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

在第三方属性namesetterclassTopicConfig中可以看到是returning TopicConfig 的实例并且不是 void return 类型。是否对 java 8 进行了任何更改,禁止在 setter returning 某些东西

的情况下配置此类类型

这不是答案,而是展示代码示例。

我尝试了以下 (Java 1.8.0_181, Spring 4.3.0.RELEASE),它构建主题 bean 没有问题:

public static void main(String[] args) {
  ApplicationContext context = new ClassPathXmlApplicationContext("spring.xml");
  ITopic topic = context.getBean("topic", ITopic.class);
}

spring.xml:

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns:hz="http://www.hazelcast.com/schema/spring"
   xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.hazelcast.com/schema/spring
    http://www.hazelcast.com/schema/spring/hazelcast-spring-3.10.xsd">

  <hz:hazelcast id="instance">
    <hz:config>
        <hz:network port="5701" port-auto-increment="false">
            <hz:join>
                <hz:multicast enabled="false"/>
                <hz:tcp-ip enabled="true">
                    <hz:interface>127.0.0.1</hz:interface>
                </hz:tcp-ip>
            </hz:join>
        </hz:network>

        <hz:topic name="my-topic" />
    </hz:config>
  </hz:hazelcast>

  <hz:topic id="topic" instance-ref="instance" name="my-topic" />

</beans>