Search code examples
javaspringhazelcast

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


I am getting the below exception while creating the bean of HazelCast. This occurs when I change the installed JRE version to jre 1.8 . However in jre 1.6 we do not get the error. Are there any changes made to jre 8 that forbids the use of such configurations.

ERROR:

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?

In the setter of the property name of the third party class TopicConfig we can see that it is returning the instance of TopicConfig and is not a void return type. Are there any changes made to java 8 which forbids the configuration of such type where setters are returning something


Solution

  • This is not an answer but is to show code sample.

    I tried following (Java 1.8.0_181, Spring 4.3.0.RELEASE), it's constructing topic bean without an issue:

    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>