java.lang.ClassNotFoundException:org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer

时间:2019-05-25 22:07:50

标签: java spring-boot

我试图为该项目运行JAR文件,但出现以下错误:

原因:java.lang.ClassNotFoundException:org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer

我试图在我的库中手动查找该类,但是该类不存在。在当前版本的spring-boot-starter-web中似乎不存在特定的类。以下是该项目的POM

<dependency>
  <groupId>junit</groupId>
  <artifactId>junit</artifactId>
  <version>4.11</version>
  <scope>test</scope>
</dependency>

  <!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-parent -->

  <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-web</artifactId>
   <version>2.1.3.RELEASE</version>
</dependency>



  <!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-jpa -->
  <dependency>
      <groupId>org.springframework.data</groupId>
      <artifactId>spring-data-jpa</artifactId>
      <version>2.1.2.RELEASE</version>
  </dependency>


  <dependency>
  <groupId>javax.servlet</groupId>
  <artifactId>javax.servlet-api</artifactId>
  <version>4.0.1</version>
  <scope>provided</scope>
</dependency>

  <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-dbcp2</artifactId>
      <version>2.1.1</version>
  </dependency>

2 个答案:

答案 0 :(得分:1)

我添加了我的项目文件夹 resources/META-INFO/spring.factories。在那之后,我得到了与上面相同的错误。我删除了文件夹,我的项目启动良好!

答案 1 :(得分:0)

尝试添加以下依赖项:

  <dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter</artifactId>
   <version>2.1.3.RELEASE</version>
  </dependency>

依赖项spring-boot-starter包括用于记录spring-boot-starter-logging的依赖项,该类具有org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer