From d9316a6db25fee1b8721153d198ba7078c7c8296 Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Fri, 18 Oct 2019 09:34:48 +0200 Subject: [PATCH] Upgrade to Spring Boot 2.2.0.RELEASE --- build.gradle.kts | 18 +++++++++--------- gradle/wrapper/gradle-wrapper.properties | 2 +- pom.xml | 10 +++++----- .../kotlin/com/example/blog/BlogProperties.kt | 15 ++++----------- .../com/example/blog/HttpControllersTests.kt | 4 ++-- 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8b73435..b07b151 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,13 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("plugin.jpa") version "1.2.71" - id("org.springframework.boot") version "2.1.5.RELEASE" - id("io.spring.dependency-management") version "1.0.7.RELEASE" - kotlin("jvm") version "1.2.71" - kotlin("plugin.spring") version "1.2.71" - kotlin("plugin.allopen") version "1.2.71" - kotlin("kapt") version "1.2.71" + kotlin("plugin.jpa") version "1.3.50" + id("org.springframework.boot") version "2.2.0.RELEASE" + id("io.spring.dependency-management") version "1.0.8.RELEASE" + kotlin("jvm") version "1.3.50" + kotlin("plugin.spring") version "1.3.50" + kotlin("plugin.allopen") version "1.3.50" + kotlin("kapt") version "1.3.50" } group = "com.example" @@ -25,7 +25,7 @@ dependencies { implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - runtimeOnly("com.h2database:h2:1.4.197") // Fixed version as a workaround for https://github.com/h2database/h2database/issues/1841 + runtimeOnly("com.h2database:h2:1.4.200") // See https://github.com/spring-projects/spring-boot/issues/18593 and https://github.com/h2database/h2database/issues/1841 runtimeOnly("org.springframework.boot:spring-boot-devtools") kapt("org.springframework.boot:spring-boot-configuration-processor") testImplementation("org.springframework.boot:spring-boot-starter-test") { @@ -34,7 +34,7 @@ dependencies { } testImplementation("org.junit.jupiter:junit-jupiter-api") testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") - testImplementation("com.ninja-squad:springmockk:1.1.2") + testImplementation("com.ninja-squad:springmockk:1.1.3") } tasks.withType { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index e0b3fb8..f04d6a2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/pom.xml b/pom.xml index 884afc1..78b1210 100644 --- a/pom.xml +++ b/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.5.RELEASE + 2.2.0.RELEASE @@ -22,7 +22,7 @@ UTF-8 UTF-8 1.8 - 1.2.71 + 1.3.50 @@ -56,11 +56,11 @@ spring-boot-devtools runtime - + com.h2database h2 - 1.4.197 + 1.4.200 runtime @@ -86,7 +86,7 @@ com.ninja-squad springmockk - 1.1.2 + 1.1.3 test diff --git a/src/main/kotlin/com/example/blog/BlogProperties.kt b/src/main/kotlin/com/example/blog/BlogProperties.kt index 46f4a0b..2e29585 100644 --- a/src/main/kotlin/com/example/blog/BlogProperties.kt +++ b/src/main/kotlin/com/example/blog/BlogProperties.kt @@ -1,17 +1,10 @@ package com.example.blog import org.springframework.boot.context.properties.ConfigurationProperties +import org.springframework.boot.context.properties.ConstructorBinding -// TODO Use "val" instead of "lateinit var" when spring-boot#8762 will be fixed +@ConstructorBinding @ConfigurationProperties("blog") -class BlogProperties { - - lateinit var title: String - val banner = Banner() - - class Banner { - var title: String? = null - lateinit var content: String - } - +data class BlogProperties(var title: String, val banner: Banner) { + data class Banner(val title: String? = null, val content: String) } diff --git a/src/test/kotlin/com/example/blog/HttpControllersTests.kt b/src/test/kotlin/com/example/blog/HttpControllersTests.kt index cee0a4d..4c5b4e7 100644 --- a/src/test/kotlin/com/example/blog/HttpControllersTests.kt +++ b/src/test/kotlin/com/example/blog/HttpControllersTests.kt @@ -27,7 +27,7 @@ class HttpControllersTests(@Autowired val mockMvc: MockMvc) { every { articleRepository.findAllByOrderByAddedAtDesc() } returns listOf(spring5Article, spring43Article) mockMvc.perform(get("/api/article/").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("\$.[0].author.login").value(juergen.login)) .andExpect(jsonPath("\$.[0].slug").value(spring5Article.slug)) .andExpect(jsonPath("\$.[1].author.login").value(juergen.login)) @@ -41,7 +41,7 @@ class HttpControllersTests(@Autowired val mockMvc: MockMvc) { every { userRepository.findAll() } returns listOf(juergen, smaldini) mockMvc.perform(get("/api/user/").accept(MediaType.APPLICATION_JSON)) .andExpect(status().isOk) - .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8)) + .andExpect(content().contentType(MediaType.APPLICATION_JSON)) .andExpect(jsonPath("\$.[0].login").value(juergen.login)) .andExpect(jsonPath("\$.[1].login").value(smaldini.login)) }