diff --git a/.travis.yml b/.travis.yml index 180c8ff..58d73fc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ install: - aws --version script: - - ./gradlew clean jooqGenerate build jacocoTestReport coveralls + - ./gradlew clean jooqGenerate build before_deploy: # Parse branch name and determine an environment to deploy diff --git a/README.md b/README.md index 7394fb8..a7175b8 100644 --- a/README.md +++ b/README.md @@ -49,11 +49,11 @@ After you migrated DB. ## Frequently asked questions -* Q) IntelliJ IDEA is very slow when you use jOOQ with Kotlin. -* A) Refer [this ticket](https://youtrack.jetbrains.com/issue/KT-10978). In my case, [tuning memory config](https://youtrack.jetbrains.com/issue/KT-10978#comment=27-1519260) of IntelliJ IDEA worked. +* Q) IntelliJ IDEA is very slow when I use jOOQ with Kotlin. + * A) Refer [this ticket](https://youtrack.jetbrains.com/issue/KT-10978). In my case, [tuning memory config](https://youtrack.jetbrains.com/issue/KT-10978#comment=27-1519260) of IntelliJ IDEA worked. * Q) How can I run or debug app from IntelliJ IDEA? -* A) Use IntelliJ IDEA 2017.1 and run or debug Application.kt. + * A) Use IntelliJ IDEA 2017.1 and run or debug Application.kt. ## Docker Support diff --git a/build.gradle b/build.gradle index 1cab3c8..5dcbd1e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,18 @@ -import groovy.xml.MarkupBuilder import org.jooq.util.GenerationTool - -import javax.xml.bind.JAXB +import org.jooq.util.jaxb.* buildscript { ext { - kotlinVersion = '1.0.6' - springBootVersion = '1.5.1.RELEASE' - jooqVersion = '3.9.0' - flywayVersion = '4.1.1' - h2Version = '1.4.193' + kotlinVersion = '1.1.1' + springBootVersion = '1.5.2.RELEASE' + jooqVersion = '3.9.1' + flywayVersion = '4.1.2' + h2Version = '1.4.194' swaggerVersion = '2.6.1' } repositories { jcenter() maven { url "https://plugins.gradle.org/m2/" } - maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' } } dependencies { classpath "org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}" @@ -27,10 +24,6 @@ buildscript { } } -plugins { - id 'jacoco' - id 'com.github.kt3k.coveralls' version '2.8.1' -} apply plugin: 'java' apply plugin: 'kotlin' apply plugin: 'kotlin-spring' @@ -47,7 +40,6 @@ sourceCompatibility = 1.8 repositories { jcenter() - maven { url 'http://dl.bintray.com/kotlin/kotlin-eap-1.1' } } dependencies { @@ -58,63 +50,49 @@ dependencies { compile group: 'org.springframework.boot', name: 'spring-boot-devtools' compile group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib', version: kotlinVersion compile group: 'org.jetbrains.kotlin', name: 'kotlin-reflect', version: kotlinVersion - compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: '2.8.6' + compile group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: '2.8.7' compile group: 'org.jooq', name: 'jooq', version: jooqVersion compile group: 'org.flywaydb', name: 'flyway-core', version: flywayVersion compile group: 'com.zaxxer', name: 'HikariCP' compile group: 'io.jsonwebtoken', name: 'jjwt', version: '0.7.0' compile group: 'io.springfox', name: 'springfox-swagger2', version: swaggerVersion compile group: 'io.springfox', name: 'springfox-swagger-ui', version: swaggerVersion - compile group: 'com.github.ulisesbocchio', name: 'jasypt-spring-boot-starter', version: '1.11' + compile group: 'com.github.ulisesbocchio', name: 'jasypt-spring-boot-starter', version: '1.12' runtime group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: '1.5.8' runtime group: 'com.h2database', name: 'h2', version: h2Version testCompile group: 'org.springframework.boot', name: 'spring-boot-starter-test' testCompile group: 'org.jetbrains.kotlin', name: 'kotlin-test-junit', version: kotlinVersion testCompile group: 'org.assertj', name: 'assertj-core', version: '3.6.2' testCompile group: 'com.nhaarman', name: 'mockito-kotlin', version: '1.1.0' - testCompile group: 'com.beust', name: 'klaxon', version: '0.27' -} - -jacocoTestReport { - reports { - xml.enabled = true // coveralls plugin depends on xml format report - html.enabled = true - } + testCompile group: 'com.beust', name: 'klaxon', version: '0.31' } flyway { - url = 'jdbc:h2:./db/dev;MODE=MySQL' + url = 'jdbc:h2:./db/tmp;MODE=MySQL' user = 'sa' password = '' } task jooqGenerate { doLast { - def writer = new StringWriter() - new MarkupBuilder(writer) - .configuration('xmlns': "http://www.jooq.org/xsd/jooq-codegen-${jooqVersion}.xsd") { - jdbc { - driver 'org.h2.Driver' - url 'jdbc:h2:./db/dev;MODE=MySQL' - user 'sa' - password '' - } - generator { - database { - inputSchema 'public' - outputSchemaToDefault 'true' - } - generate { - } - target { - packageName 'com.myapp.generated' - directory 'src/main/java' - } - } - } - GenerationTool.generate( - JAXB.unmarshal(new StringReader(writer.toString()), org.jooq.util.jaxb.Configuration.class) - ) + Configuration configuration = new Configuration() + .withJdbc(new Jdbc() + .withDriver("org.h2.Driver") + .withUrl("jdbc:h2:./db/tmp;MODE=MySQL") + .withUser("sa") + .withPassword("") + ) + .withGenerator(new Generator() + .withDatabase(new Database() + .withInputSchema("public") + .withOutputSchemaToDefault(true) + ) + .withTarget(new Target() + .withPackageName("com.myapp.generated") + .withDirectory("src/main/java") + ) + ) + GenerationTool.generate(configuration) } } jooqGenerate.dependsOn flywayMigrate diff --git a/src/main/kotlin/com/myapp/auth/SecurityContextServiceImpl.kt b/src/main/kotlin/com/myapp/auth/SecurityContextServiceImpl.kt index 65b7ce6..e24aa9f 100644 --- a/src/main/kotlin/com/myapp/auth/SecurityContextServiceImpl.kt +++ b/src/main/kotlin/com/myapp/auth/SecurityContextServiceImpl.kt @@ -5,10 +5,8 @@ import com.myapp.domain.UserDetailsImpl import org.slf4j.LoggerFactory import org.springframework.security.core.context.SecurityContextHolder import org.springframework.stereotype.Service -import org.springframework.transaction.annotation.Transactional @Service -@Transactional class SecurityContextServiceImpl : SecurityContextService { @Suppress("unused")