title: Gradle exclude SLF4J from Spring
body: <p>Well, the following code works but it does not really look good. I have a Spring Boot project and I want to exclude SLF4J because I would like to use Log4j2 instead.</p>
  
  <p>Does anyone know how to improve the code?</p>
  
  <pre><code>dependencies {
      compile("org.springframework:spring-context") {
          exclude module: "spring-boot-starter-logging"
          exclude module: "logback-classic"
      }
      compile("org.springframework.boot:spring-boot-starter-web") {
          exclude module: "spring-boot-starter-logging"
          exclude module: "logback-classic"
      }
      compile("org.springframework.boot:spring-boot-starter-data-mongodb") {
          exclude module: "spring-boot-starter-logging"
          exclude module: "logback-classic"
      }
      compile("org.springframework.boot:spring-boot-starter-log4j2")
      providedRuntime("org.apache.tomcat.embed:tomcat-embed-jasper")
      testCompile("junit:junit")
  }
  </code></pre>