Я добавил в свою конфигурацию следующее свойство:
server.session.cookie.max-age=3600
HTTP-заголовок Set-Cookie:
Set-Cookie: JSESSIONID=3407BD3E1C7153D70EFC5DBD16B059E4; Path=/; Secure; HttpOnly
Так что кажется, что Spring игнорирует это свойство. Это устарело? Если нет, то почему он не работает?
Вот моя конфигурация:
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests()
.anyRequest()
.authenticated()
.and()
.formLogin()
.successForwardUrl("/")
.defaultSuccessUrl("/", true)
.permitAll()
.and()
.logout().logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.deleteCookies("JSESSIONID")
.invalidateHttpSession(true)
.and()
.rememberMe()
.key("key")
.tokenValiditySeconds(86400);
}




В Spring Boot 2.1.4 вы должны использовать свойство server.servlet.session.cookie.max-age вместо server.session.cookie.max-age, см. Справочное руководство по загрузке Spring:
Appendix A. Common application properties
Various properties can be specified inside your
application.propertiesfile, inside yourapplication.ymlfile, or as command line switches. This appendix provides a list of common Spring Boot properties and references to the underlying classes that consume them.[...]
# EMBEDDED SERVER CONFIGURATION (ServerProperties) [...] server.servlet.session.cookie.max-age= # Maximum age of the session cookie. If a duration suffix is not specified, seconds will be used.
spring-boot-starter-parent — это 2.1.4.RELEASE, а spring-boot-starter-web на самом деле 2.1.0.RELEASE