【发布时间】:2017-11-21 20:25:26
【问题描述】:
当 1.5.3 运行良好时。 但是升级到 1.5.4 启动失败...
异常:2017-06-19 22:41:13,400:ERROR org.springframework.beans.factory.support.DefaultSingletonBeanRegistry main (DefaultSingletonBeanRegistry.java:581) - 销毁 bean 上的方法 有名字 'org.springframework.context.annotation.internalScheduledAnnotationProcessor' 抛出异常 java.lang.IllegalStateException: ApplicationEventMulticaster 未初始化 - 之前调用“刷新” 通过上下文多播事件: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3a45c42a: 启动日期 [Mon Jun 19 22:41:11 CST 2017];上下文层次的根 在 org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 bing.AuthorityApplication.main(AuthorityApplication.java:40) [类/:?] 2017-06-19 22:41:13,407:ERROR org.springframework.beans.factory.support.DefaultSingletonBeanRegistry main (DefaultSingletonBeanRegistry.java:581) - 销毁 bean 上的方法 有名字 'org.springframework.boot.context.properties.ConfigurationPropertiesBindingPostProcessor' 抛出异常 java.lang.IllegalStateException: ApplicationEventMulticaster 未初始化 - 之前调用“刷新” 通过上下文多播事件: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3a45c42a: 启动日期 [Mon Jun 19 22:41:11 CST 2017];上下文层次的根 在 org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 bing.AuthorityApplication.main(AuthorityApplication.java:40) [classes/:?] 2017-06-19 22:41:13,409:ERROR org.springframework.beans.factory.support.DefaultSingletonBeanRegistry main (DefaultSingletonBeanRegistry.java:581) - 销毁 bean 上的方法 有名字 'org.springframework.boot.autoconfigure.internalCachingMetadataReaderFactory' 抛出异常 java.lang.IllegalStateException: ApplicationEventMulticaster 未初始化 - 之前调用“刷新” 通过上下文多播事件: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@3a45c42a: 启动日期 [Mon Jun 19 22:41:11 CST 2017];上下文层次的根 在 org.springframework.context.support.AbstractApplicationContext.getApplicationEventMulticaster(AbstractApplicationContext.java:414) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) ~[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) ~[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] 在 org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] 在 bing.AuthorityApplication.main(AuthorityApplication.java:40) [课程/:?] 2017-06-19 22:41:13,422:INFO org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer 主要(AutoConfigurationReportLoggingInitializer.java:101) -
启动 ApplicationContext 时出错。显示自动配置 报告启用“调试”后重新运行您的应用程序。 2017-06-19 22:41:13,663:错误 org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter 主要(LoggingFailureAnalysisReporter.java:42) -
***************************应用程序启动失败
说明:
方法methodValidationPostProcessor的参数1在 org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration 需要一个“javax.validation.Validator”类型的 bean,它不能 成立。 - 因为@ConditionalOnMissingBean(类型: javax.validation.Validator; SearchStrategy: all) 找到的bean 'mvcValidator'
行动:
考虑重新审视上述条件或定义一个 bean 类型 'javax.validation.Validator' 在你的配置中。
这是我的自定义验证配置,将消息源与 jsr303 集成
@Configuration
public class ValidationMessageConfig {
@Bean
public LocalValidatorFactoryBean mvcValidator(MessageSource messageSource) {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource);
return factory;
}
}
【问题讨论】:
-
请提供更多详细信息,并使用代码格式化按钮格式化您的输出。但是,就您当前的问题而言,您无法格式化输出,因为代码多于您所遇到问题的实际描述。我尝试自己格式化,但无法提交建议的编辑。