I have implemented spring session in spring MVC application. It is creating session tables in my database and storing the session ids. But i am not able to change the 'MaxInactiveIntervalInSeconds' value. In XML based configuration i have changed 'MaxInactiveIntervalInSeconds' value like below.
<bean class="org.springframework.session.jdbc.config.annotation.web.http.JdbcHttpSessionConfiguration">
<property name="maxInactiveIntervalInSeconds">
<value>60</value>
</property>
</bean>
and it is working fine. But i am not able to change the 'MaxInactiveIntervalInSeconds' value in java based configuration. I have tried the following.
@Bean
public JdbcHttpSessionConfiguration setMaxInactiveIntervalInSeconds(JdbcHttpSessionConfiguration jdbcHttpSessionConfiguration) {
jdbcHttpSessionConfiguration.setMaxInactiveIntervalInSeconds(60);
return jdbcHttpSessionConfiguration;
}
But it is not working.
My SessionConfig and SessionInitializer classes are like below.
@Configuration
@EnableJdbcHttpSession
public class SessionConfig {
@Bean
public PlatformTransactionManager transactionManager(DataSource dataSource) {
return new DataSourceTransactionManager(dataSource);
}
@Bean
public JdbcHttpSessionConfiguration setMaxInactiveIntervalInSeconds(JdbcHttpSessionConfiguration jdbcHttpSessionConfiguration) {
jdbcHttpSessionConfiguration.setMaxInactiveIntervalInSeconds(60);
return jdbcHttpSessionConfiguration;
}
}
and
public class SessionInitializer extends AbstractHttpSessionApplicationInitializer {
}
Is there any way to achieve this?