diff --git a/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle b/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle index 94ee8163..f677cd38 100644 --- a/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle +++ b/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle @@ -1,22 +1,19 @@ apply plugin: 'io.spring.convention.spring-sample-boot' dependencies { - compile project(':spring-session-data-redis') + compile "org.springframework.boot:spring-boot-starter-data-redis" compile "org.springframework.boot:spring-boot-starter-web" compile "org.springframework.boot:spring-boot-starter-thymeleaf" compile "org.springframework.boot:spring-boot-starter-security" - compile "org.springframework.boot:spring-boot-starter-data-redis" compile "org.springframework.boot:spring-boot-devtools" + compile "org.springframework.session:spring-session" compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect" - compile "org.thymeleaf.extras:thymeleaf-extras-java8time" compile "org.webjars:bootstrap" compile "org.webjars:html5shiv" compile "org.webjars:webjars-locator" compile "com.maxmind.geoip2:geoip2" compile "org.apache.httpcomponents:httpclient" - compile project(':spring-session-hazelcast') - testCompile "org.springframework.boot:spring-boot-starter-test" testCompile "org.assertj:assertj-core" diff --git a/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java b/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java index 944590d8..9327f3d4 100644 --- a/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java +++ b/samples/boot/findbyusername/src/main/java/sample/mvc/IndexController.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2017 the original author or authors. + * Copyright 2014-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,8 +21,8 @@ import java.util.Collection; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.session.ExpiringSession; import org.springframework.session.FindByIndexNameSessionRepository; -import org.springframework.session.Session; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.PathVariable; @@ -39,11 +39,11 @@ import org.springframework.web.bind.annotation.RequestMethod; public class IndexController { // tag::findbyusername[] @Autowired - FindByIndexNameSessionRepository extends Session> sessions; + FindByIndexNameSessionRepository extends ExpiringSession> sessions; @RequestMapping("/") public String index(Principal principal, Model model) { - Collection extends Session> usersSessions = this.sessions + Collection extends ExpiringSession> usersSessions = this.sessions .findByIndexNameAndIndexValue( FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, principal.getName()) @@ -60,7 +60,7 @@ public class IndexController { FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME, principal.getName()).keySet(); if (usersSessionIds.contains(sessionIdToDelete)) { - this.sessions.deleteById(sessionIdToDelete); + this.sessions.delete(sessionIdToDelete); } return "redirect:/"; diff --git a/samples/boot/findbyusername/src/main/resources/templates/index.html b/samples/boot/findbyusername/src/main/resources/templates/index.html index 14dcb1bc..447b8a16 100644 --- a/samples/boot/findbyusername/src/main/resources/templates/index.html +++ b/samples/boot/findbyusername/src/main/resources/templates/index.html @@ -21,8 +21,8 @@