SpringBoot启动:LoggerFactory is not a Logback LoggerContext but Logback is on the classpath

  • 可能原因一:slf4j异常及解决办法

  • 可能原因二:在SpringBoot项目里面,日志的绑定顺序有严格要求

解决办法:调整SpringBoot相关pom.xml文件,将引入的SpringBoot配置文件放在最前。

<dependencies>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-configuration-processorartifactId>
            <version>2.2.2.RELEASEversion>
            <optional>trueoptional>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webfluxartifactId>
            <version>2.2.2.RELEASEversion>
        dependency>

        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-webartifactId>
            <version>2.2.2.RELEASEversion>
        dependency>
        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-testartifactId>
            <version>2.2.2.RELEASEversion>
            <scope>testscope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintagegroupId>
                    <artifactId>junit-vintage-engineartifactId>
                exclusion>
            exclusions>
        dependency>
        
        
   dependencies>

你可能感兴趣的:(Java)