From 23c6c7cf31c094d16aa03b22bd072b4ca2610800 Mon Sep 17 00:00:00 2001 From: Vedran Pavic Date: Thu, 27 Jul 2017 13:35:01 +0200 Subject: [PATCH] Upgrade Spring Boot to 2.0.0.M3 Closes gh-841 --- gradle.properties | 4 ++-- gradle/dependency-management.gradle | 18 +++++++++++------- ...g-session-sample-boot-findbyusername.gradle | 4 ++-- .../main/java/sample/mvc/IndexController.java | 10 +++++----- .../src/main/resources/templates/index.html | 4 ++-- .../boot/gradle/dependency-management.gradle | 6 ------ .../spring-session-sample-boot-jdbc.gradle | 3 +-- ...pring-session-sample-boot-redis-json.gradle | 5 ++--- .../spring-session-sample-boot-redis.gradle | 4 ++-- ...spring-session-sample-boot-websocket.gradle | 5 ++--- .../java/sample/config/WebSocketConfig.java | 6 +++--- .../sample/config/WebSocketHandlersConfig.java | 4 ++-- 12 files changed, 34 insertions(+), 39 deletions(-) delete mode 100644 samples/boot/gradle/dependency-management.gradle diff --git a/gradle.properties b/gradle.properties index 2969909d..0e62e6cd 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -springBootVersion=2.0.0.M2 -version=2.0.0.BUILD-SNAPSHOT \ No newline at end of file +springBootVersion=2.0.0.M3 +version=2.0.0.BUILD-SNAPSHOT diff --git a/gradle/dependency-management.gradle b/gradle/dependency-management.gradle index 522a12af..0e442d3d 100644 --- a/gradle/dependency-management.gradle +++ b/gradle/dependency-management.gradle @@ -5,11 +5,15 @@ dependencyManagement { mavenBom 'org.springframework.data:spring-data-releasetrain:Kay-BUILD-SNAPSHOT' mavenBom 'org.springframework.security:spring-security-bom:5.0.0.BUILD-SNAPSHOT' } + dependencies { - dependency 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr3' - dependency 'com.h2database:h2:1.4.195' - dependency 'com.hazelcast:hazelcast-client:3.8' - dependency 'com.hazelcast:hazelcast:3.8' + dependencySet(group: 'com.hazelcast', version: '3.8.3') { + entry 'hazelcast' + entry 'hazelcast-client' + } + + dependency 'com.fasterxml.jackson.core:jackson-databind:2.9.0.pr4' + dependency 'com.h2database:h2:1.4.196' dependency 'com.maxmind.geoip2:geoip2:2.3.1' dependency 'commons-codec:commons-codec:1.10' dependency 'edu.umd.cs.mtc:multithreadedtc:1.01' @@ -21,10 +25,10 @@ dependencyManagement { dependency 'org.apache.derby:derby:10.13.1.1' dependency 'org.apache.httpcomponents:httpclient:4.5.3' dependency 'org.apache.taglibs:taglibs-standard-jstlel:1.2.5' - dependency 'org.assertj:assertj-core:3.6.2' + dependency 'org.assertj:assertj-core:3.8.0' dependency 'org.hsqldb:hsqldb:2.4.0' - dependency 'org.mockito:mockito-core:2.7.22' - dependency 'org.seleniumhq.selenium:htmlunit-driver:2.26' + dependency 'org.mockito:mockito-core:2.8.47' + dependency 'org.seleniumhq.selenium:htmlunit-driver:2.27' dependency 'org.webjars:bootstrap:2.3.2' dependency 'org.webjars:html5shiv:3.7.3' dependency 'org.webjars:jquery:1.9.0' diff --git a/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle b/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle index 6474dc05..bb1f2a9d 100644 --- a/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle +++ b/samples/boot/findbyusername/spring-session-sample-boot-findbyusername.gradle @@ -1,12 +1,12 @@ apply plugin: 'io.spring.convention.spring-sample-boot' dependencies { - compile "org.springframework.boot:spring-boot-starter-data-redis" + compile project(':spring-session-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.webjars:bootstrap" compile "org.webjars:html5shiv" 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 9327f3d4..944590d8 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-2016 the original author or authors. + * Copyright 2014-2017 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 sessions; + FindByIndexNameSessionRepository sessions; @RequestMapping("/") public String index(Principal principal, Model model) { - Collection usersSessions = this.sessions + Collection 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.delete(sessionIdToDelete); + this.sessions.deleteById(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 447b8a16..14dcb1bc 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 @@ - - + +
diff --git a/samples/boot/gradle/dependency-management.gradle b/samples/boot/gradle/dependency-management.gradle deleted file mode 100644 index 2590cbe6..00000000 --- a/samples/boot/gradle/dependency-management.gradle +++ /dev/null @@ -1,6 +0,0 @@ -dependencyManagement { - dependencies { - dependency 'io.lettuce:lettuce-core:5.0.0.M2' - } -} - diff --git a/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle b/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle index 5d8f31b3..e8828118 100644 --- a/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle +++ b/samples/boot/jdbc/spring-session-sample-boot-jdbc.gradle @@ -1,12 +1,11 @@ apply plugin: 'io.spring.convention.spring-sample-boot' dependencies { - compile "org.springframework.boot:spring-boot-starter-jdbc" + compile project(':spring-session-jdbc') 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-devtools" - compile "org.springframework.session:spring-session" compile "nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect" compile "org.webjars:bootstrap" compile "org.webjars:html5shiv" diff --git a/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle b/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle index 5fba1ee4..fec2cba1 100644 --- a/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle +++ b/samples/boot/redis-json/spring-session-sample-boot-redis-json.gradle @@ -1,17 +1,16 @@ apply plugin: 'io.spring.convention.spring-sample-boot' dependencies { - compile "org.springframework.boot:spring-boot-starter-data-redis" + compile project(':spring-session-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.webjars:bootstrap" compile "org.webjars:html5shiv" compile "org.webjars:webjars-locator" - compile "io.lettuce:lettuce-core" compile "org.apache.httpcomponents:httpclient" testCompile "org.springframework.boot:spring-boot-starter-test" diff --git a/samples/boot/redis/spring-session-sample-boot-redis.gradle b/samples/boot/redis/spring-session-sample-boot-redis.gradle index 0900f95f..9dc3cc81 100644 --- a/samples/boot/redis/spring-session-sample-boot-redis.gradle +++ b/samples/boot/redis/spring-session-sample-boot-redis.gradle @@ -1,12 +1,12 @@ apply plugin: 'io.spring.convention.spring-sample-boot' dependencies { - compile "org.springframework.boot:spring-boot-starter-data-redis" + compile project(':spring-session-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.webjars:bootstrap" compile "org.webjars:html5shiv" diff --git a/samples/boot/websocket/spring-session-sample-boot-websocket.gradle b/samples/boot/websocket/spring-session-sample-boot-websocket.gradle index 7864a80f..f73e634b 100644 --- a/samples/boot/websocket/spring-session-sample-boot-websocket.gradle +++ b/samples/boot/websocket/spring-session-sample-boot-websocket.gradle @@ -1,14 +1,14 @@ apply plugin: 'io.spring.convention.spring-sample-boot' dependencies { - compile "org.springframework.boot:spring-boot-starter-data-redis" + compile project(':spring-session-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-jpa" + compile "org.springframework.boot:spring-boot-starter-data-redis" compile "org.springframework.boot:spring-boot-starter-websocket" compile "org.springframework.boot:spring-boot-devtools" - compile "org.springframework.session:spring-session" compile "org.springframework:spring-websocket" compile "org.springframework.security:spring-security-messaging" compile "org.springframework.security:spring-security-data" @@ -19,7 +19,6 @@ dependencies { compile "org.webjars:sockjs-client" compile "org.webjars:stomp-websocket" compile "org.webjars:webjars-locator" - compile "io.lettuce:lettuce-core" compile "com.h2database:h2" testCompile "org.springframework.boot:spring-boot-starter-test" diff --git a/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java b/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java index 8a28a553..abd602ef 100644 --- a/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java +++ b/samples/boot/websocket/src/main/java/sample/config/WebSocketConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2014-2016 the original author or authors. + * Copyright 2014-2017 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. @@ -19,7 +19,7 @@ package sample.config; import org.springframework.context.annotation.Configuration; import org.springframework.messaging.simp.config.MessageBrokerRegistry; import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.session.ExpiringSession; +import org.springframework.session.Session; import org.springframework.session.web.socket.config.annotation.AbstractSessionWebSocketMessageBrokerConfigurer; import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker; import org.springframework.web.socket.config.annotation.StompEndpointRegistry; @@ -29,7 +29,7 @@ import org.springframework.web.socket.config.annotation.StompEndpointRegistry; @EnableScheduling @EnableWebSocketMessageBroker public class WebSocketConfig - extends AbstractSessionWebSocketMessageBrokerConfigurer { // <1> + extends AbstractSessionWebSocketMessageBrokerConfigurer { // <1> protected void configureStompEndpoints(StompEndpointRegistry registry) { // <2> registry.addEndpoint("/messages").withSockJS(); diff --git a/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java b/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java index 6e0eeafe..bc59fe7d 100644 --- a/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java +++ b/samples/boot/websocket/src/main/java/sample/config/WebSocketHandlersConfig.java @@ -23,7 +23,7 @@ import sample.websocket.WebSocketDisconnectHandler; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.messaging.simp.SimpMessageSendingOperations; -import org.springframework.session.ExpiringSession; +import org.springframework.session.Session; /** * These handlers are separated from WebSocketConfig because they are specific to this @@ -32,7 +32,7 @@ import org.springframework.session.ExpiringSession; * @author Rob Winch */ @Configuration -public class WebSocketHandlersConfig { +public class WebSocketHandlersConfig { @Bean public WebSocketConnectHandler webSocketConnectHandler(