创建类路径资源中定义的名称为“ sessionRepositoryFilterRegistration”的bean时出错

时间:2019-01-22 17:09:45

标签: java spring jpa gradle entity

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

错误

const input = [
    {
        "frequency": [7, 6, 2, 1],
        "description": "Walk 100km",
        "color": "#E97825",
        "activities": [
            {"completed": true, "completed_at": 1546646400},
            {"completed": true, "completed_at": 1546819200},
            {"completed": true, "completed_at": 1546905600},
            {"completed": true, "completed_at": 1547251200},
            {"completed": false, "completed_at": 1547424000},
            {"completed": true, "completed_at": 1547510400},
            {"completed": true, "completed_at": 1547856000},
            {"completed": false, "completed_at": 1548028800}
        ]
    },
    {
        "frequency": [5, 4, 3, 1],
        "description": "Drink 4lt Water",
        "color": "#ED1E24",
        "activities": [
             {"completed": true, "completed_at": 1546387200},
             {"completed": true, "completed_at": 1546473600},
             {"completed": false, "completed_at": 1546560000},
             {"completed": false, "completed_at": 1546819200},
             {"completed": true, "completed_at": 1546992000},
             {"completed": false, "completed_at": 1547078400},
             {"completed": false, "completed_at":1547164800},
             {"completed": false, "completed_at":1547424000},
             {"completed": true, "completed_at":1547596800},
             {"completed": false, "completed_at":1547683200},
             {"completed": true, "completed_at":1547769600},
             {"completed": true, "completed_at":1548028800}
        ]
    },
    {
        "frequency": [7, 6, 5, 4, 3, 2, 1],
        "description": "Study 2",
        "color": "#F4ED59",
        "activities": [
            {"completed": false, "completed_at": 1546387200},
            {"completed": true, "completed_at": 1546473600},
            {"completed": true, "completed_at": 1546560000},
            {"completed": true, "completed_at": 1546646400},
            {"completed": true, "completed_at": 1546819200},
            {"completed": false, "completed_at": 1546905600},
            {"completed": true, "completed_at": 1546992000},
            {"completed": true, "completed_at": 1547078400},
            {"completed": false, "completed_at": 1547164800},
            {"completed": true, "completed_at": 1547251200},
            {"completed": true, "completed_at": 1547424000},
            {"completed": false, "completed_at": 1547510400},
            {"completed": true, "completed_at": 1547596800},
            {"completed": false,"completed_at": 1547683200},
            {"completed": true, "completed_at": 1547769600},
            {"completed": false, "completed_at": 1547856000},
            {"completed": false, "completed_at": 1548028800}
        ]
    },
    {
        "frequency": [7, 6, 5, 4],
        "description": "Home drinking food2",
        "color": "#00A651",
        "activities": [
            {"completed": true, "completed_at": 1546473600},
            {"completed": true, "completed_at": 1546560000},
            {"completed": true, "completed_at": 1546646400},
            {"completed": true, "completed_at": 1547078400},
            {"completed": true, "completed_at": 1547164800},
            {"completed": true, "completed_at": 1547251200},
            {"completed": false, "completed_at": 1547683200},
            {"completed": true, "completed_at": 1547769600},
            {"completed": true, "completed_at": 1547856000}
        ]
    },
    {
        "frequency": [7, 4, 3, 2, 1],
        "description": "New habit 4",
        "color": "#912AD6",
        "activities": [
            {"completed": true, "completed_at": 1546387200},
            {"completed": true, "completed_at": 1546473600},
            {"completed": true, "completed_at": 1546819200},
            {"completed": true, "completed_at": 1546905600},
            {"completed": false, "completed_at": 1546992000},
            {"completed": true, "completed_at": 1547078400},
            {"completed": false, "completed_at": 1547424000},
            {"completed": true, "completed_at": 1547510400},
            {"completed": true, "completed_at": 1547596800},
            {"completed": true, "completed_at": 1547683200},
            {"completed": true, "completed_at": 1548028800}
        ]
    }
];

let res = input.map(x =>
{
    x.activities = x.activities.filter(
        ({completed_at}) => completed_at <= 1546646400
    );
    return x;
});

console.log(res);

build.gradle contents.build.gradle contents.build.gradle contents.build.gradle contents.buildle.gradle

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

1 个答案:

答案 0 :(得分:0)

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

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