完整报错如下

Exception in thread "main" java.lang.AbstractMethodError: org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/Class;)Z
at org.springframework.context.event.GenericApplicationListenerAdapter.supportsSourceType(GenericApplicationListenerAdapter.java:79)
at org.springframework.context.event.AbstractApplicationEventMulticaster.supportsEvent(AbstractApplicationEventMulticaster.java:289)
at org.springframework.context.event.AbstractApplicationEventMulticaster.retrieveApplicationListeners(AbstractApplicationEventMulticaster.java:221)
at org.springframework.context.event.AbstractApplicationEventMulticaster.getApplicationListeners(AbstractApplicationEventMulticaster.java:192)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:128)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:122)
at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:76)
at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:53)
at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:342)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:305)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1204)
at com.yiyi.demo2.Demo2Application.main(Demo2Application.java:13)
ERROR StatusLogger Log4j2 could not find a logging implementation. Please add log4j-core to the classpath. Using SimpleLogger to log to the console...

在查阅一些资料后发现有的说是调整parent的版本,也就是

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

这里调整后可能不会有问题,可能又会有新的问题如下

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
at org.springframework.boot.SpringApplication.<clinit>(SpringApplication.java:196)
at com.yiyi.demo2.Demo2Application.main(Demo2Application.java:13)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more

对应的parent

<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

这个问题其实就是依赖的问题,在定义了父依赖后这里还定义了

<dependency>
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>Brussels-SR4</version>
<type>pom</type>
<scope>import</scope>
</dependency>

然后就出现上面的情况,使用Spring IO进行Spring jar包版本管理,已经做了如下配置,如果再添加上述依赖的话就会造成版本冲突,产生错误。
在查看Spring官网后发现,现在的Spring官方推荐使用parent作为版本管理​​​Spring IO平台​

org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/_java


那么我们就直接去掉platform-bom这个依赖管理,然后重启

org.springframework.boot.context.config.ConfigFileApplicationListener.supportsSourceType(Ljava/lang/_spring_02


启动成功!看到这个启动的输出,懂得人应该知道我这是在整合SpringSecurityOAuth2,对的没错,在整合SpringSecurityOAuth2的时候其实是比较麻烦的,依赖的版本不同导致其流程上会有区别,看过我之前的文章的道友应该知道,之前写SpringSecurity和OAuth的时候是使用的下面的依赖

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>

但是在搭建系统的时候这里就需要注意了,如果项目的SpringBoot版本不能改变,那么就需要改变security和oauth2的依赖配置!