【转载】 Spring Boot 全局排除 spring-boot-starter-logging 依赖

本文连接:https://blog.csdn.net/u013314786/article/details/90412733

项目里使用了log4j2做日志处理,要排除掉Spring Boot 很多jar里边默认依赖的日志包spring-boot-starter-logging。一个一个写依赖排除也可以,但是太繁琐了,经过尝试,只让它依赖个spring-boot-starter-logging的空壳,里边的东西全部排除掉即可。使用下边的方式就可以达到想要的效果。

 <!--全局排除spring-boot-starter-logging内的所有依赖-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

  

要全局排除其他依赖,也可采用这种方式。

posted @ 2019-11-30 10:40  飞向狙沙  阅读(1362)  评论(0编辑  收藏  举报