【问题标题】:Error creating bean with name 'sessionRepositoryFilterRegistration' defined in class path resource在类路径资源中定义名称为“sessionRepositoryFilterRegistration”的 bean 创建错误
【发布时间】:2019-06-16 05:12:02
【问题描述】:

执行弹簧后发生错误。请告诉我如何解决它。 我需要你的帮助。

错误

2019-01-22 20:23:25.416  INFO 8692 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 19145 ms
    2019-01-22 20:23:25.759 ERROR 8692 --- [ost-startStop-1] o.s.b.web.embedded.tomcat.TomcatStarter  : Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'sessionRepositoryFilterRegistration' defined in class path resource [org/springframework/boot/autoconfigure/session/SessionRepositoryFilterConfiguration.class]: Unsatisfied dependency expressed through method 'sessionRepositoryFilterRegistration' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.session.RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.NoSuchMethodError: org.springframework.boot.autoconfigure.session.RedisSessionConfiguration$SpringBootRedisHttpSessionConfiguration.setCleanupCron(Ljava/lang/String;)V
    2019-01-22 20:23:25.839  WARN 8692 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
    :bootRun FAILED

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':bootRun'.
    > Process 'command 'C:\Program Files\Java\jdk1.8.0_121\bin\java.exe'' finished with non-zero exit value 1

build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容build.gradle 内容

buildscript {

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

apply plugin: 'java'

apply plugin: 'eclipse'

apply plugin: 'org.springframework.boot'


group = 'com.example'

version = '0.0.1-SNAPSHOT'

sourceCompatibility = 1.8

repositories {

    mavenCentral()

    maven {

        url 'https://jitpack.io'

    }
}

dependencies {
    compile group: 'mysql', name: 'mysql-connector-java', version: '5.1.46'

    compile('org.springframework.boot:spring-boot-starter-data-jpa:2.0.0.RELEASE')
    compile('org.springframework.boot:spring-boot-starter-web:2.0.0.RELEASE')
    compile('javax.validation:validation-api:2.0.0.Final')
    compile('org.apache.commons:commons-lang3:3.6')
    compile group: 'org.hibernate', name: 'hibernate-core', version: '5.2.14.Final'
    compile files('lib/gsf-3.0.jar')

    // new
    compile ('com.voodoodyne.jackson.jsog:jackson-jsog:1.0')
    compile('org.springframework.boot:spring-boot-starter-security:2.0.0.RELEASE')
    compile('org.springframework.boot:spring-boot-starter-thymeleaf:2.0.0.RELEASE')
    compile('nz.net.ultraq.thymeleaf:thymeleaf-layout-dialect:2.3.0')
    compile ('com.google.guava:guava:23.3-jre')
    compile('org.springframework.session:spring-session:1.3.1.RELEASE')
    compile('org.springframework.session:spring-session-data-redis:1.3.1.RELEASE')
    compile('org.glassfish:javax.el:3.0.1-b08')
    compile("com.querydsl:querydsl-core:4.1.4")
    compile("com.querydsl:querydsl-jpa:4.1.4")
    compile("com.querydsl:querydsl-apt:4.1.4")
    compile('org.springframework.data:spring-data-redis:2.0.5.RELEASE')
    compile('org.springframework.data:spring-data-jpa:2.0.5.RELEASE')
    compile('org.springframework.security.oauth:spring-security-oauth2:2.3.3.RELEASE')

    compile('org.springframework.security:spring-security-core:5.0.3.RELEASE')
    compile('com.squareup.okhttp3:okhttp:3.8.0')
    compile('com.squareup.retrofit2:retrofit:2.3.0')
    compile('com.github.iamport:iamport-rest-client-java:0.1.10')
    compile('com.alibaba:fastjson:1.2.47')
    compile ('org.json:json:20180813')
    compile ('org.apache.xmlgraphics:batik-transcoder:1.7')
    compile('org.springframework:spring-test:2.5')
    compile('commons-validator:commons-validator:1.6')

    runtime('mysql:mysql-connector-java')
    compileOnly('org.projectlombok:lombok:1.16.20')
    testCompile('org.springframework.boot:spring-boot-starter-test')
}

【问题讨论】:

    标签: java spring jpa gradle entity


    【解决方案1】:

    添加以下依赖项帮助我解决了上述问题。

    compile "org.springframework.session:spring-session-data-redis:2.0.3.RELEASE"
    

    【讨论】:

      猜你喜欢
      • 2015-10-16
      • 2019-01-22
      • 2019-08-17
      • 2021-09-20
      • 2019-12-30
      • 2022-01-18
      • 2021-02-26
      相关资源
      最近更新 更多