小编Lak*_*hmi的帖子

java.lang.IllegalStateException:ApplicationEventMulticaster未初始化 - 在通过上下文组播事件之前调用'refresh'

我正在尝试创建一个Spring Boot项目.

pom.xml中:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.java</groupId>
  <artifactId>spring-boot-example</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <name>Java Spring Boot Example</name>
  <parent>  
    <groupId>org.springframework.boot</groupId>  
    <artifactId>spring-boot-starter-parent</artifactId>  
    <version>1.4.2.RELEASE</version>  
</parent>    
<dependencies>  
    <dependency>  
        <groupId>org.springframework.boot</groupId>  
        <artifactId>spring-boot-starter-web</artifactId>  
    </dependency> 

    </dependencies>  
<properties>  
    <java.version>1.8</java.version>  
</properties>  
</project>
Run Code Online (Sandbox Code Playgroud)

SpringBootExample.java:

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication 
public class SpringBootExample {

    public static void main(String[] args) {
         SpringApplication.run(SpringBootExample.class, args);  
    }
}
Run Code Online (Sandbox Code Playgroud)

当尝试将上述类作为Java应用程序执行时,我收到错误:

2017-06-21 17:07:14.125 ERROR 7860 --- [main] osbfsDefaultListableBeanFactory:名为'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory'的bean上的Destroy方法引发异常

java.lang.IllegalStateException:ApplicationEventMulticaster未初始化 - 在通过上下文组播事件之前调用'refresh':org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@63f509:启动日期[Wed Jun 21 17:07:06 EDT 2017]; org.springframework.context.support上的org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:404)[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]中的上下文层次结构的根org.springframework.beans.factory.support.DisposableBeanAdapter.destroy中的.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97)〜[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE](DisposableBeanAdapter.java: 253)〜[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)[spring-beans-4.3. 4.RELEASE.jar:4.3.4.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)[spring-beans-4.3.4.RELEASE.jar:4.3.4.发布在org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListable)BeanFactory.java:954)[spring-beans-4.3.4.RELEASE.jar:4.3.4.RELEASE] org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)[spring-beans] -4.3.4.RELEASE.jar:4.3.4.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:961)[spring-beans-4.3.4.RELEASE.jar:4.3 .4.RELEASE]在org.springframework.context的org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1033)[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE]. support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555)[spring-context-4.3.4.RELEASE.jar:4.3.4.RELEASE] org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java: …

spring spring-boot

7
推荐指数
1
解决办法
2万
查看次数

标签 统计

spring ×1

spring-boot ×1