spring boot 项目启动报错:原因一般是注入了相同名字的service

 -- :: com.gxcards.mes.MainWwwWeb: logStartupProfileInfo INFO: No active profile set, falling back to default profiles: default
-- :: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: prepareRefresh INFO: Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
-- :: org.springframework.beans.factory.support.DefaultListableBeanFactory: registerBeanDefinition INFO: Overriding bean definition for bean 'restTemplate' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=restTemplateConfiguration; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/gxcards/mes/config/RestTemplateConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=mainGoodsService; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/gxcards/mes/MainGoodsService.class]]
-- :: org.springframework.beans.factory.support.DefaultListableBeanFactory: registerBeanDefinition INFO: Overriding bean definition for bean 'restTemplate' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=mainGoodsService; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [com/gxcards/mes/MainGoodsService.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=; dependencyCheck=; autowireCandidate=true; primary=false; factoryBeanName=mainWwwWeb; factoryMethodName=restTemplate; initMethodName=null; destroyMethodName=(inferred); defined in com.gxcards.mes.MainWwwWeb]
-- :: org.springframework.boot.SpringApplication: reportFailure ERROR: Application startup failed
java.lang.UnsupportedOperationException
at java.util.AbstractCollection.add(AbstractCollection.java:)
at java.util.AbstractCollection.addAll(AbstractCollection.java:)
at org.springframework.boot.web.servlet.ServletComponentScanRegistrar.updatePostProcessor(ServletComponentScanRegistrar.java:)
at org.springframework.boot.web.servlet.ServletComponentScanRegistrar.registerBeanDefinitions(ServletComponentScanRegistrar.java:)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.gxcards.mes.MainWwwWeb.main(MainWwwWeb.java:)
-- :: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: doClose INFO: Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
-- :: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext: doClose WARN: Exception thrown from LifecycleProcessor on context close
java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.gxcards.mes.MainWwwWeb.main(MainWwwWeb.java:)
-- :: org.springframework.beans.factory.support.DefaultListableBeanFactory: destroyBean ERROR: Destroy method on bean with name 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' threw an exception
java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@: startup date [Thu Aug :: CST ]; parent: org.springframework.context.annotation.AnnotationConfigApplicationContext@764faa6
at org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:)
at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:)
at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:)
at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:)
at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:)
at org.springframework.boot.SpringApplication.handleRunFailure(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:)
at com.gxcards.mes.MainWwwWeb.main(MainWwwWeb.java:)
Disconnected from the target VM, address: '127.0.0.1:61286', transport: 'socket'

说是在项目中有了相同的 Overriding bean definition for bean 'restTemplate',原来是在我的这个项目的pom文件中引用了另一个项目,另一个项目也注入有restTemplate,导致启动报错。把本项目中的引用的另一个项目删除就解决了。

java.lang.IllegalStateException: ApplicationEventMulticaster not initialized - call 'refresh' before multicasting events via the context 错误的更多相关文章

  1. eclipse启动报错java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' befo

    报错: java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invo ...

  2. java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: Root WebApplicationContext: startup date [Mon Oct 01 16:32:37 CS

    使用idea工具更改项目包名时报 :java.lang.ClassNotFoundException 解决方案: 1.删除项目的target目录,这个目录存放的是编译后的文件 2.清除缓存 3.重新编 ...

  3. java.lang.IllegalStateException: ApplicationEventMulticaster not initialized

    <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring- ...

  4. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext这个问题

    今天在运行别人的SSH项目时,遇到了这个问题 严重: Exception sending context initialized event to listener instance of class ...

  5. java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    spring的项目中有时候会报错:java.lang.IllegalStateException: BeanFactory not initialized or already closed - ca ...

  6. 解决java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext问题

    使用ClassPathXmlApplicationContext加载项目时, ClassPathXmlApplicationContext context = new ClassPathXmlAppl ...

  7. 项目启动异常,java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext

    java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' befo ...

  8. ApplicationEventMulticaster not initialized - call 'refresh' before

    https://stackoverflow.com/questions/45318618/applicationeventmulticaster-not-initialized-call-refres ...

  9. Tomcat启动之异常java.lang.IllegalStateException

    严重: Exception sending context destroyed event to listener instance of class org.springframework.web. ...

随机推荐

  1. Spring中@Async

    在Java应用中,绝大多数情况下都是通过同步的方式来实现交互处理的:但是在处理与第三方系统交互的时候,容易造成响应迟缓的情况,之前大部分都是使用多线程来完成此类任务,其实,在spring 3.x之后, ...

  2. MODBUS协议解析中常用的转换帮助类(C#)

    p{ text-align:center; } blockquote > p > span{ text-align:center; font-size: 18px; color: #ff0 ...

  3. Why ngx-uploader doesn't like to cooperate with .net core 2.x?

    The POST action seems to have no effect on the .net core controller. If you put [IgnoreAntiforgeryTo ...

  4. Asp.Net Core WebApi 和Asp.Net WebApi上传文件

    public class UpLoadController : ControllerBase { private readonly IHostingEnvironment _hostingEnviro ...

  5. BeautifulReport 实现app UI自动化测试

    修改了 BeautifulReport源码中的一些内容<附:BeautifulReport--适用于unittest自动化测试的可视化报告>; 1.生成截图时,原来的img文件夹必须在项目 ...

  6. JavaScript笔记1———js的一些常识

    一.什么是js? js是一种运行于解释器中的解释型脚本语言. 二.js的组成部分? 1.ECMAScript-----这是js的核心 2.DOM-----让js可以对网页进行操作(例:对页面元素的增. ...

  7. 关于eric4和pyqt的入门学习(转)

    在Eric4下用PyQt4编写Python的图形界面程序 转载请注明作者RunningOn 本文是PyQt4的入门教程.网上能搜到其它教程,但我觉得讲得不是很清楚,希望这篇文章对入门者更加有帮助. 先 ...

  8. 画多边形form并填充背景色(可以实现圆角边框 有锯齿)

    public Form1() { InitializeComponent(); this.BackColor = ColorTranslator.FromHtml("#F7F1F1" ...

  9. iframe父子操作

    1.js在iframe子页面操作父页面元素代码: window.parent.document.getElementByIdx_x("父页面元素id"); 2.js在父页面获取if ...

  10. Transparent PageRoute in Flutter for displaying a (semi-) transparent page

    import 'package:flutter/widgets.dart'; class TransparentRoute extends PageRoute<void> { Transp ...