Migracja Spring Boota z 1.5.22 do 2.0.0

0

Cześć. Podbijam Spring Boota w projekcie(docelowo 2.7.0) i mam problem. Java 8. Żeby podbić do 2.0.0 muszę pozamieniać save() na saveAll(), podmieniam driver postgresa: compile group: 'postgresql', name: 'postgresql', version:'9.1-901-1.jdbc4' na implementation 'org.postgresql:postgresql:42.2.9', dodaję też do application.properties tę linijkę:
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true. Po tym mi się buduje bez błędów, tylko no właśnie: jak zaczynam strzelać Postmanem, to przy prawidłowym tokenie mam 401. (Przed podbiciem 200). Jak zacząłem analizować, to się okazało, że po podbiciu Springa jak projekt się buduje, to na localhost tworzone są tablice prawidłowo, ale są puste stąd ta 401. Totalnie nie wiem jak to obejść. Mielibyście pomysł? Wklejam build.gradle:

import org.apache.tools.ant.filters.ReplaceTokens

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'org.springframework.boot:spring-boot-gradle-plugin:2.0.0.RELEASE'
    }
}

plugins {
    id "io.franzbecker.gradle-lombok" version "1.11"
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'org.springframework.boot'
apply plugin: "io.spring.dependency-management"

project.version =  '1.1.5'

jar {
    baseName = 'refurbishment'
    version =  project.version
}

sourceSets {
    util {
        compileClasspath += sourceSets.main.runtimeClasspath
    }
}

sourceCompatibility = 1.8
targetCompatibility = 1.8


repositories {

     maven { url "http://projectlombok.org/mavenrepo" }
     maven { url "http://repo.maven.apache.org/maven2" }
}
dependencies {
    compile 'org.springframework.boot:spring-boot-starter-web'
    compile 'org.springframework.boot:spring-boot-starter-actuator'
    compile group: 'org.springframework.security.oauth', name: 'spring-security-oauth2', version: '2.5.2.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-mail', version:'1.5.8.RELEASE'
    compile group: 'org.springframework.security', name: 'spring-security-jwt', version:'1.1.1.RELEASE'
    compile group: 'org.springframework.boot', name: 'spring-boot-starter-data-jpa', version:'1.5.8.RELEASE'
    implementation 'org.springframework.boot:spring-boot-properties-migrator:2.1.18.RELEASE'
    testCompile 'org.springframework.boot:spring-boot-starter-test'

    compile group: 'org.hibernate', name: 'hibernate-validator', version:'5.2.4.Final'
    compile group: 'com.google.guava', name: 'guava', version:'16.0.1'
    compile group: 'joda-time', name: 'joda-time', version:'2.8.2'
    compile group: 'commons-lang', name: 'commons-lang', version:'2.6'
    compile group: 'net.sf.ehcache', name: 'ehcache-core', version:'2.6.9'

    implementation 'org.postgresql:postgresql:42.2.9'
    compile group: 'io.jsonwebtoken', name: 'jjwt', version:'0.6.0'

    compile group: 'org.projectlombok', name: 'lombok', version:'1.16.6'
    compile group: 'org.apache.commons', name: 'commons-csv', version:'1.2'
    compile group: 'com.google.code.gson', name: 'gson', version:'2.6.2'
    compile group: 'commons-io', name: 'commons-io', version:'2.4'
    compile group: 'org.json', name: 'json', version:'20160212'

    compile group: 'io.springfox', name: 'springfox-swagger-ui', version:'2.5.0'
    compile group: 'io.springfox', name: 'springfox-swagger2', version:'2.5.0'
    compile group: 'com.fasterxml', name: 'classmate', version:'1.3.1'

    compile 'com.microsoft.azure:azure-storage:5.4.0'
    runtime group: 'com.microsoft.sqlserver', name: 'mssql-jdbc', version: '6.3.4.jre8-preview'
    compile files('libs/PDFjet-5.1.jar')

    testCompile(group: 'junit', name: 'junit')
    //DBUnit
    testCompile 'org.dbunit:dbunit:2.5.3'
    testCompile 'com.github.springtestdbunit:spring-test-dbunit:1.3.0'

    testCompile group: 'org.hamcrest', name: 'hamcrest-all', version:'1.3'
    testCompile group: 'org.assertj', name: 'assertj-core', version:'1.7.0'
    testCompile(group: 'org.mockito', name: 'mockito-core', version:'1.10.19') {
        exclude(module: 'hamcrest-core')
    }
    testCompile group: 'org.springframework', name: 'spring-test', version:'4.2.6.RELEASE'
    testCompile group: 'com.jayway.jsonpath', name: 'json-path', version:'2.0.0'
    testCompile group: 'com.jayway.jsonpath', name: 'json-path-assert', version:'0.9.1'
}

bootRun {
    def profiles = findProperty('profiles')
    if (profiles) {
        args = ["--spring.profiles.active=" + profiles]
    }
}

task copyWebConfig(type: Copy) {
    from('src/main/templates') {
        include 'web.config'
    }
    into "$buildDir/libs"
    filter(ReplaceTokens, tokens: [VERSION: project.version])
    inputs.property("VERSION", project.version)
}

assemble.dependsOn(copyWebConfig)
0

Rozwiązane. Trzeba było w application.properties dodać:
spring.datasource.initialization-mode=always
i jest 200 :)

1 użytkowników online, w tym zalogowanych: 0, gości: 1