Upgrade to Boot 2.0.0.RC1 and Kotlin 1.2

This commit is contained in:
sdeleuze
2018-02-16 17:59:45 +01:00
parent b43e9fdde6
commit 142f3e5af2
8 changed files with 75 additions and 60 deletions

View File

@@ -43,5 +43,3 @@ A Spring Data version based on [spring-data-jdbc-repository](https://github.com/
- [Exposed issue #24](https://github.com/JetBrains/Exposed/issues/24): see if Exposed could support natively data classes + repository patten.
- [Spring HATEOAS issue #401](https://github.com/spring-projects/spring-hateoas/issues/401): add HATEOAS support, but without having to extend
`ResourceSupport` or wrapping it into a `Resource<Foo>` container .
- [Kotlin issue KT-11235](https://youtrack.jetbrains.com/issue/KT-11235): avoid mandatory usage of `arrayOf` in annotation array attribute
(for example in `@SpringApplicationConfiguration(classes = arrayOf(Application::class))`.

View File

@@ -1,52 +1,69 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
plugins {
val kotlinVersion = "1.2.21"
id("org.jetbrains.kotlin.jvm") version kotlinVersion
id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion
id("io.spring.dependency-management") version "1.0.4.RELEASE"
}
buildscript {
extra["kotlinVersion"] = "1.1.2-4"
val kotlinVersion = "1.2.21"
repositories {
mavenCentral()
}
dependencies {
classpath(kotlinModule("gradle-plugin", extra["kotlinVersion"] as String))
classpath(kotlinModule("allopen", extra["kotlinVersion"] as String))
classpath("org.springframework.boot:spring-boot-gradle-plugin:1.5.3.RELEASE")
}
repositories {
mavenCentral()
maven("https://repo.spring.io/milestone")
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath("org.jetbrains.kotlin:kotlin-allopen:${kotlinVersion}")
classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RC1")
}
}
apply {
plugin("kotlin")
plugin("kotlin-spring")
plugin("org.springframework.boot")
plugin("org.springframework.boot")
}
tasks {
withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "1.8"
freeCompilerArgs = listOf("-Xjsr305=strict")
}
}
}
repositories {
mavenCentral()
maven { setUrl("https://dl.bintray.com/kotlin/exposed") }
maven { setUrl("https://dl.bintray.com/sdeleuze/maven/") }
mavenCentral()
maven("https://repo.spring.io/milestone")
maven("https://dl.bintray.com/kotlin/exposed")
maven("https://dl.bintray.com/sdeleuze/maven/")
}
dependencies {
compile("org.springframework.boot:spring-boot-starter-web") {
exclude(module = "spring-boot-starter-validation")
}
compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("org.springframework.boot:spring-boot-devtools")
compile("org.springframework.boot:spring-boot-starter-web") {
exclude(module = "spring-boot-starter-validation")
}
compile("org.springframework.boot:spring-boot-starter-jdbc")
compile("org.springframework.boot:spring-boot-devtools")
compile(kotlinModule("stdlib", extra["kotlinVersion"] as String))
compile(kotlinModule("reflect", extra["kotlinVersion"] as String))
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
compile("org.jetbrains.kotlin:kotlin-reflect")
compile("com.fasterxml.jackson.module:jackson-module-kotlin")
compile(exposedModule("exposed"))
compile(exposedModule("spring-transaction"))
compile("org.postgresql:postgresql:9.4.1208")
compile("net.postgis:postgis-jdbc:2.2.0") {
exclude(module = "postgresql")
}
compile("com.github.mayconbordin:postgis-geojson:1.1") {
exclude(module = "postgresql")
}
compile("org.jetbrains.exposed:exposed:0.8")
compile("org.jetbrains.exposed:spring-transaction:0.8")
compile("org.postgresql:postgresql:9.4.1208")
compile("net.postgis:postgis-jdbc:2.2.0") {
exclude(module = "postgresql")
}
compile("com.github.mayconbordin:postgis-geojson:1.1") {
exclude(module = "postgresql")
}
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.restdocs:spring-restdocs-mockmvc:1.1.1.RELEASE")
testCompile("org.springframework.boot:spring-boot-starter-test")
testCompile("org.springframework.restdocs:spring-restdocs-mockmvc:1.1.1.RELEASE")
}
fun exposedModule(module: String) = "org.jetbrains.exposed:$module:0.8"

View File

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://repo.gradle.org/gradle/dist-snapshots/gradle-script-kotlin-4.0-20170518042627+0000-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-all.zip

View File

@@ -9,8 +9,8 @@ import io.spring.messenger.repository.UserRepository
import org.jetbrains.exposed.spring.SpringTransactionManager
import org.postgis.geojson.PostGISModule
import org.springframework.boot.CommandLineRunner
import org.springframework.boot.SpringApplication
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
import org.springframework.context.annotation.Bean
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder
@@ -51,5 +51,5 @@ class Application {
}
fun main(args: Array<String>) {
SpringApplication.run(Application::class.java, *args)
runApplication<Application>(*args)
}

View File

@@ -19,7 +19,7 @@ class DefaultMessageRepository : MessageRepository {
override fun createTable() = SchemaUtils.create(Messages)
override fun create(m: Message): Message {
m.id = Messages.insert(toRow(m)).get(Messages.id)
m.id = Messages.insert(toRow(m))[Messages.id]
return m
}
@@ -27,9 +27,9 @@ class DefaultMessageRepository : MessageRepository {
override fun findByBoundingBox(box: PGbox2d) = Messages.select { Messages.location within box }.map { fromRow(it) }
override fun updateLocation(id:Int, location: Point) {
override fun updateLocation(userName:Int, location: Point) {
location.srid = 4326
Messages.update({ Messages.id eq id}) { it[Messages.location] = location}
Messages.update({ Messages.id eq userName }) { it[Messages.location] = location}
}
override fun deleteAll() = Messages.deleteAll()

View File

@@ -18,9 +18,9 @@ class DefaultUserRepository: UserRepository {
override fun createTable() = SchemaUtils.create(Users)
override fun create(user: User): User {
Users.insert(toRow(user))
return user
override fun create(m: User): User {
Users.insert(toRow(m))
return m
}
override fun updateLocation(userName:String, location: Point) {

View File

@@ -34,13 +34,13 @@ import org.springframework.test.context.junit4.SpringRunner
@SpringBootTest
class MessageControllerTests {
@Rule @JvmField val restDoc = JUnitRestDocumentation("build/generated-snippets")
@Autowired lateinit var context: WebApplicationContext
@Autowired lateinit var messageRepository: MessageRepository
@Autowired lateinit var userRepository: UserRepository
@Autowired lateinit var mapper: ObjectMapper
lateinit var mockMvc: MockMvc
lateinit var document: RestDocumentationResultHandler
@Rule @JvmField final val restDoc = JUnitRestDocumentation("build/generated-snippets")
@Autowired lateinit var context: WebApplicationContext
@Autowired lateinit var messageRepository: MessageRepository
@Autowired lateinit var userRepository: UserRepository
@Autowired lateinit var mapper: ObjectMapper
lateinit var mockMvc: MockMvc
lateinit var document: RestDocumentationResultHandler
@Before fun setUp() {
messageRepository.deleteAll()

View File

@@ -34,13 +34,13 @@ import org.springframework.test.context.junit4.SpringRunner
@SpringBootTest
class UserControllerTests {
@Rule @JvmField val restDoc = JUnitRestDocumentation("build/generated-snippets")
@Autowired lateinit var context: WebApplicationContext
@Autowired lateinit var userRepository: UserRepository
@Autowired lateinit var messageRepository: MessageRepository
@Autowired lateinit var mapper: ObjectMapper
lateinit var mockMvc: MockMvc
lateinit var document: RestDocumentationResultHandler
@Rule @JvmField final val restDoc = JUnitRestDocumentation("build/generated-snippets")
@Autowired lateinit var context: WebApplicationContext
@Autowired lateinit var userRepository: UserRepository
@Autowired lateinit var messageRepository: MessageRepository
@Autowired lateinit var mapper: ObjectMapper
lateinit var mockMvc: MockMvc
lateinit var document: RestDocumentationResultHandler
@Before fun setUp() {
messageRepository.deleteAll()