springBoot启动报错:
Exception in thread “main” java.lang.IllegalArgumentException: Cannot instantiate interface org.springframework.context.ApplicationListener : org.springframework.boot.autoconfigure.BackgroundPreinitializer
1- 排查发现 两个依赖不可以同时存在~~ 需要删掉一个
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
2- 发现还是不行 ,进一步排查;发现 父级依赖跟启动依赖的版本不一致(可能是引入的版本过高了,改成相同的版本号);如下
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.1.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.2.1.RELEASE</version>
</dependency>
</dependencies>
3-重新编译后 – 再启动 (一定不要忘记 rebuild)
启动成功~~~~ over