Upgrade to Spring Boot 2.2.0.RELEASE

This commit is contained in:
Sebastien Deleuze
2019-10-18 09:34:48 +02:00
parent 8a2902c243
commit d9316a6db2
5 changed files with 21 additions and 28 deletions

View File

@@ -1,13 +1,13 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins { plugins {
kotlin("plugin.jpa") version "1.2.71" kotlin("plugin.jpa") version "1.3.50"
id("org.springframework.boot") version "2.1.5.RELEASE" id("org.springframework.boot") version "2.2.0.RELEASE"
id("io.spring.dependency-management") version "1.0.7.RELEASE" id("io.spring.dependency-management") version "1.0.8.RELEASE"
kotlin("jvm") version "1.2.71" kotlin("jvm") version "1.3.50"
kotlin("plugin.spring") version "1.2.71" kotlin("plugin.spring") version "1.3.50"
kotlin("plugin.allopen") version "1.2.71" kotlin("plugin.allopen") version "1.3.50"
kotlin("kapt") version "1.2.71" kotlin("kapt") version "1.3.50"
} }
group = "com.example" group = "com.example"
@@ -25,7 +25,7 @@ dependencies {
implementation("com.fasterxml.jackson.module:jackson-module-kotlin") implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect") implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") 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") runtimeOnly("org.springframework.boot:spring-boot-devtools")
kapt("org.springframework.boot:spring-boot-configuration-processor") kapt("org.springframework.boot:spring-boot-configuration-processor")
testImplementation("org.springframework.boot:spring-boot-starter-test") { testImplementation("org.springframework.boot:spring-boot-starter-test") {
@@ -34,7 +34,7 @@ dependencies {
} }
testImplementation("org.junit.jupiter:junit-jupiter-api") testImplementation("org.junit.jupiter:junit-jupiter-api")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine") 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<KotlinCompile> { tasks.withType<KotlinCompile> {

View File

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists 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 zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

10
pom.xml
View File

@@ -14,7 +14,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.5.RELEASE</version> <version>2.2.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository --> <relativePath/> <!-- lookup parent from repository -->
</parent> </parent>
@@ -22,7 +22,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<kotlin.version>1.2.71</kotlin.version> <kotlin.version>1.3.50</kotlin.version>
</properties> </properties>
<dependencies> <dependencies>
@@ -56,11 +56,11 @@
<artifactId>spring-boot-devtools</artifactId> <artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<!-- Fixed version as a workaround for https://github.com/h2database/h2database/issues/1841 --> <!-- See https://github.com/spring-projects/spring-boot/issues/18593 and https://github.com/h2database/h2database/issues/1841 -->
<dependency> <dependency>
<groupId>com.h2database</groupId> <groupId>com.h2database</groupId>
<artifactId>h2</artifactId> <artifactId>h2</artifactId>
<version>1.4.197</version> <version>1.4.200</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency> <dependency>
@@ -86,7 +86,7 @@
<dependency> <dependency>
<groupId>com.ninja-squad</groupId> <groupId>com.ninja-squad</groupId>
<artifactId>springmockk</artifactId> <artifactId>springmockk</artifactId>
<version>1.1.2</version> <version>1.1.3</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>

View File

@@ -1,17 +1,10 @@
package com.example.blog package com.example.blog
import org.springframework.boot.context.properties.ConfigurationProperties 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") @ConfigurationProperties("blog")
class BlogProperties { data class BlogProperties(var title: String, val banner: Banner) {
data class Banner(val title: String? = null, val content: String)
lateinit var title: String
val banner = Banner()
class Banner {
var title: String? = null
lateinit var content: String
}
} }

View File

@@ -27,7 +27,7 @@ class HttpControllersTests(@Autowired val mockMvc: MockMvc) {
every { articleRepository.findAllByOrderByAddedAtDesc() } returns listOf(spring5Article, spring43Article) every { articleRepository.findAllByOrderByAddedAtDesc() } returns listOf(spring5Article, spring43Article)
mockMvc.perform(get("/api/article/").accept(MediaType.APPLICATION_JSON)) mockMvc.perform(get("/api/article/").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk) .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].author.login").value(juergen.login))
.andExpect(jsonPath("\$.[0].slug").value(spring5Article.slug)) .andExpect(jsonPath("\$.[0].slug").value(spring5Article.slug))
.andExpect(jsonPath("\$.[1].author.login").value(juergen.login)) .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) every { userRepository.findAll() } returns listOf(juergen, smaldini)
mockMvc.perform(get("/api/user/").accept(MediaType.APPLICATION_JSON)) mockMvc.perform(get("/api/user/").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk) .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("\$.[0].login").value(juergen.login))
.andExpect(jsonPath("\$.[1].login").value(smaldini.login)) .andExpect(jsonPath("\$.[1].login").value(smaldini.login))
} }