Using Hazelcast for session management in Spring Non Boot Application

49 views Asked by At

I have one non boot spring application and i want to implement hazelcast-session for that. PFB the code snippet- pom.xml

<dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-core</artifactId>
            <version>5.3.13.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.session</groupId>
            <artifactId>spring-session-hazelcast</artifactId>
            <version>2.4.0</version> <!-- Replace with the latest version --> 
        </dependency> 

Hazelcast Configuration file

    @Bean
    @Qualifier("hazelCastIntance")
    public HazelcastInstance hazelCastIntance() {
         ClientConfig config = new ClientConfig();
        Properties prop = PropertiesUtils.getCustomProps();
        config.setGroupConfig(new GroupConfig("dev", ""));
         HazelcastInstance client = HazelcastClient.newHazelcastClient(hazelCastConfig());
         return client;
    }

session.xml file

<bean id="sessionRepository" class="org.springframework.session.hazelcast.HazelcastIndexedSessionRepository">
        <constructor-arg ref="hazelCastIntance" />
    </bean>

With this configuration session is not persisting into hazelcast. Let me know what i've done wrong in the configuration.

0

There are 0 answers