报错信息如下:
2022-04-21 17:43:26.473 ERROR [em-service,,,] 17272 --- [ main] org.springframework.boot.SpringApplication : Application run failed
java.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration.propertySourcesPlaceholderConfigurer
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64)
at org.springframework.context.annotation.ConditionEvaluator.shouldSkip(ConditionEvaluator.java:108)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForBeanMethod(ConfigurationClassBeanDefinitionReader.java:180)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:141)
at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:117)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:328)
at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:233)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:271)
at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:91)
at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:694)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:532)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:140)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:762)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:398)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:330)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1258)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1246)
at com.ey.fssc.em.EmApplication.main(EmApplication.java:30)
Caused by: java.lang.reflect.MalformedParameterizedTypeException: null
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.validateConstructorArguments(ParameterizedTypeImpl.java:58)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.<init>(ParameterizedTypeImpl.java:51)
at sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl.make(ParameterizedTypeImpl.java:92)
at sun.reflect.generics.factory.CoreReflectionFactory.makeParameterizedType(CoreReflectionFactory.java:105)
at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:140)
at sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
at sun.reflect.generics.repository.MethodRepository.getReturnType(MethodRepository.java:68)
at java.lang.reflect.Method.getGenericReturnType(Method.java:255)
at org.springframework.core.MethodParameter.getGenericParameterType(MethodParameter.java:419)
at org.springframework.core.SerializableTypeWrapper$MethodParameterTypeProvider.getType(SerializableTypeWrapper.java:317)
at org.springframework.core.SerializableTypeWrapper.forTypeProvider(SerializableTypeWrapper.java:137)
at org.springframework.core.ResolvableType.forType(ResolvableType.java:1384)
at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1285)
at org.springframework.core.ResolvableType.forMethodParameter(ResolvableType.java:1251)
at org.springframework.core.ResolvableType.forMethodReturnType(ResolvableType.java:1194)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.getTypeForFactoryMethod(AbstractAutowireCapableBeanFactory.java:779)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.determineTargetType(AbstractAutowireCapableBeanFactory.java:659)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.predictBeanType(AbstractAutowireCapableBeanFactory.java:627)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1489)
at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(AbstractBeanFactory.java:1012)
at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:180)
at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanTypeForNonAliasDefinition(BeanTypeRegistry.java:160)
at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.addBeanType(BeanTypeRegistry.java:153)
at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.updateTypesIfNecessary(BeanTypeRegistry.java:215)
at org.springframework.boot.autoconfigure.condition.BeanTypeRegistry.getNamesForType(BeanTypeRegistry.java:115)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.collectBeanNamesForType(OnBeanCondition.java:265)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getBeanNamesForType(OnBeanCondition.java:254)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchingBeans(OnBeanCondition.java:196)
at org.springframework.boot.autoconfigure.condition.OnBeanCondition.getMatchOutcome(OnBeanCondition.java:116)
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:47)
... 17 common frames omitted
at org.springframework.boot.autoconfigure.condition.SpringBootCondition.matches(SpringBootCondition.java:64)
以为是PropertyPlaceholderAutoConfiguration类没有自动匹配上,查了一下,不是这个问题。
然后通过:
Caused by: java.lang.reflect.MalformedParameterizedTypeException: null
at java.lang.reflect.Method.getGenericReturnType(Method.java:255)
at org.springframework.core.MethodParameter.getGenericParameterType(MethodParameter.java:419)
发现可能是类型不匹配的问题,到错误发生的地方断点,调试:
从图中可以看出,redis进行配置的时候,返回的类型是GenericObjectPoolConfig<?>,搜索代码,找到redis配置数据源的地方:
定义返回类型确实是GenericObjectPoolConfig<?>,然而,单击GenericObjectPoolConfig,跳转到:
发现引用的类,竟然GenericObjectPoolConfig后不带泛型,好奇怪!
难道是版本问题?于是,查看项目依赖树,发现果然猜测没错,引入了两个不同版本commons-pool的jar:
查阅代码,在2.8.0版本中,用的是带泛型的GenericObjectPoolConfig<T>:
问题找到了,于是在pom依赖里边,排除2.5.0版本的jar包。
重启项目,正常。
遇到问题要冷静,不能只看到问题表象,必要时断点进行原因跟踪查找。
报错:Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderA
报错信息如下:2022-04-21 17:43:26.473 ERROR [em-service,,,] 17272 --- [ main] org.springframework.boot.SpringApplication : Application run failedjava.lang.IllegalStateException: Error processing condition on org.springframework.boot.autoconfigure.c...
java
.lang.IllegalStateExcept
ion
:
Error
processing
condit
ion
on
org
.
springframework
.
boot
.
auto
configure
.
context
.
Property
Placeholder
Auto
Configurat
ion
.
property
Sources
Placeholder
Configure
r
报错
解决
<depe...
以下是错误信息
2020-08-04 10:41:45.441 [main]
ERROR
[
org
.
springframework
.
boot
.
Spring
Applicat
ion
:840] - Applicat
ion
startup failed
java
.lang.IllegalStateExcept
ion
:
Error
processing
condit
ion
on
org
.
springframework
.
boot
.actuate.
auto
configure
.EndpointWebMvc
Auto
Conf
搭建用
spring
boot
搭建
spring
cloud项目时出现这个问题.
java
.lang.IllegalStateExcept
ion
:
Error
processing
condit
ion
on
org
.
springframework
.
boot
.
auto
configure
.
context
.
Property
Placeholder
Auto
Configurat
ion
.
property
Sources
Placeholder
Configure
r
at
org
.
springframework
.
boot
.
auto
co
错误信息如下:
java
.lang.IllegalStateExcept
ion
:
Error
processing
condit
ion
on
org
.
springframework
.
boot
.
auto
configure
.kafka.Kafka
Auto
Configurat
ion
.kafkaProducerListener
at
org
.
springframework
.
boot
.
auto
co...
java
.lang.IllegalStateExcept
ion
:
Error
processing
condit
ion
on
org
.
springframework
.
boot
.
auto
configure
.
context
.MessageSource
Auto
Configurat
ion
这个错误是由于在处理
Spring
Boot
自动配置中的MessageSource
Auto
Configurat
ion
时发生了条件错误引起的。具体原因可能是条件评估过程中出现了问题,导致无法正确配置消息源。
要解决这个问题,你可以尝试以下几个步骤:
1. 检查你的应用程序的依赖项,确保所有相关的
Spring
Boot
和消息源依赖项都已正确配置和导入。
2. 如果你正在使用自定义条件注解或条件类,请确保它们实现了正确的逻辑,并且没有出现错误。
3. 检查你的应用程序配置文件,特别是与消息源相关的配置项,确保其正确配置。
4. 尝试清除并重新构建你的项目,以确保所有依赖项正确加载和配置。
如果以上方法仍然无法解决问题,你可以尝试查看详细的错误堆栈跟踪信息,这可能会提供更多关于问题的线索。如果问题仍然存在,你可能需要查阅官方文档或寻求
Spring
社区的帮助来进一步排查和解决这个问题。
报错:Error processing condition on org.springframework.boot.autoconfigure.context.PropertyPlaceholderA
16014