添加javax.servlet-api依赖项会引发org.slf4j.impl.StaticLoggerBinder无法加载的异常,但我不使用sl4j,我使用thymeleaf



基本标题。我正在尝试运行简单的Spring5 Thymeleaf项目。如果我不添加servlet-api,我会发现

的错误
cannot access javax.servlet.ServletException
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation

但是我不使用sl4j,我使用胸腺。servlet异常如何与SL4J连接,我应该如何管理它?

upd

我知道我的问题是错误的。但是我需要有关连接问题的帮助:正如某人的建议,我添加了

<dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.5</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.5</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>

但我仍然无法加载类" org.slf4j.impl.staticloggerbinder"。例外。有什么想法吗?

upd

正如这里提到的人一样,这是IDE的错误

在您的依赖项或项目中添加slf4j.jar。春季在内部使用SLF4J进行自己的记录。

我正在使用intelij Idea。作为某人的兴高采烈,我添加了log4j和sl4j依赖项,因为默认情况下使用了servlet-api的使用。我的例外是,类别未能加载的课程只是另一个问题中提到的IDE的一个错误,并且包括记录在内的所有内容都很好。

最新更新