当1.5.3运作良好时。 但升级到1.5.4开始失败......
例外:2017-06-19 22:41:13,400:错误 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] at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) 〜[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) 〜[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at bing.AuthorityApplication.main(AuthorityApplication.java:40) [classes /:?] 2017-06-19 22:41:13,407:错误 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] at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) 〜[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) 〜[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at bing.AuthorityApplication.main(AuthorityApplication.java:40) [classes /:?] 2017-06-19 22:41:13,409:错误 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] at org.springframework.context.support.ApplicationListenerDetector.postProcessBeforeDestruction(ApplicationListenerDetector.java:97) 〜[spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:253) 〜[spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968) [spring-beans-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:556) [spring-context-4.3.9.RELEASE.jar:4.3.9.RELEASE] at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.SpringApplication.run(SpringApplication.java:303) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at org.springframework.boot.builder.SpringApplicationBuilder.run(SpringApplicationBuilder.java:134) [spring-boot-1.5.4.RELEASE.jar:1.5.4.RELEASE] at bing.AuthorityApplication.main(AuthorityApplication.java:40) [classes /:?] 2017-06-19 22:41:13,422:INFO org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer main(AutoConfigurationReportLoggingInitializer.java:101) -
启动ApplicationContext时出错。显示自动配置 报告使用' debug'重新运行您的应用程序启用。 2017年6月19日 22:41:13663:ERROR org.springframework.boot.diagnostics.LoggingFailureAnalysisReporter main(LoggingFailureAnalysisReporter.java:42) -
***************************申请失败
说明
方法methodValidationPostProcessor的参数1 org.springframework.boot.autoconfigure.validation.ValidationAutoConfiguration 需要一个类型为#javax.validation.Validator'的bean。那不可能 找到。 - Bean方法' defaultValidator' in' ValidationAutoConfiguration'未加载,因为@ConditionalOnMissingBean(类型: javax.validation.Validator; SearchStrategy:all)找到了bean ' mvcValidator'
动作:
考虑重新审视上述条件或定义类型的bean ' javax.validation.Validator'在你的配置中。
这是我的自定义验证配置,与jsr303集成的messagesource
@Configuration
public class ValidationMessageConfig {
@Bean
public LocalValidatorFactoryBean mvcValidator(MessageSource messageSource) {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource);
return factory;
}
}
答案 0 :(得分:0)
不确定它如何/为什么适用于1.5.3,但您应该通过从Validator
带注释的方法返回一个来配置默认@Bean
。像这样改写:
@Bean
public Validator mvcValidator(MessageSource messageSource) {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource);
return factory;
}
答案 1 :(得分:0)
我有同样的问题并解决了这个问题。像这样重写你的配置。
@Configuration
public class ValidationMessageConfig extends WebMvcConfigurerAdapter {
@Autowired
private MessageSource messageSource;
@Override
public Validator getValidator() {
LocalValidatorFactoryBean factory = new LocalValidatorFactoryBean();
factory.setValidationMessageSource(messageSource);
return factory;
}
}