spring(错误二) Error creating bean with name 'xxxx'
来源:互联网 发布:宾馆网络电视怎么打开 编辑:程序博客网 时间:2024/06/05 02:57
报错信息如下:
[QPWA.WL] 2016-07-04 18:05:25 [ERROR] (ContextLoader.java:331) - Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'alipayBaseConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.qpwa.payment.config.AlipayBaseConfig.partner; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)at java.util.concurrent.FutureTask.run(FutureTask.java:262)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)at java.lang.Thread.run(Thread.java:745)Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.qpwa.payment.config.AlipayBaseConfig.partner; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)... 22 moreCaused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:142)at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1318)at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:782)at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)... 24 moreCaused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:246)at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:112)at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:107)at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:49)at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93)at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:89)at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:139)... 28 more七月 04, 2016 6:05:25 下午 org.apache.catalina.core.StandardContext listenerStart严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'alipayBaseConfig': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.qpwa.payment.config.AlipayBaseConfig.partner; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:296)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:293)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:410)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4994)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5492)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1575)at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1565)at java.util.concurrent.FutureTask.run(FutureTask.java:262)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)at java.lang.Thread.run(Thread.java:745)Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.qpwa.payment.config.AlipayBaseConfig.partner; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:517)at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)... 22 moreCaused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:142)at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1318)at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:782)at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:770)at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:489)... 24 moreCaused by: org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 0): Field or property 'configProperties' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:246)at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:112)at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:107)at org.springframework.expression.spel.ast.CompoundExpression.getValueRef(CompoundExpression.java:49)at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93)at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:89)at org.springframework.context.expression.StandardBeanExpressionResolver.evaluate(StandardBeanExpressionResolver.java:139)... 28 more
解决办法:
1.检查web.xml 是否写错了
2.检查spring配置相关的配置,是否配置错误;尤其注意看一下spring自动扫描的包路径.
3.检查spring mvc相关配置,是否配置错误
本案中我的项目是这样解决的:
我的web工程的spring配置名称为:spring-context.xml,而web工程中某一jar包的spring配置为:applicationContext-context.xml
原因就是web工程的配置文件只是配置扫描spring-context.xml,忽略了applicationContext-context.xml
找到原因之后,解决起来就很简单了:
在web.xml中添加配置:
<!-- 设置Spring容器加载配置文件路径 --> <param-name>contextConfigLocation</param-name> <param-value> classpath*:/spring.xml, classpath*:config/spring/applicationContext-context.xml</param-value> </context-param>问题解决!
0 0
- spring(错误二) Error creating bean with name 'xxxx'
- spring常见错误:Error creating bean with name 'xxx'
- 记录一次SpringBoot Error creating bean with name 'xxxx'
- Error creating bean with name...
- Error creating bean with name 。。。
- Error creating bean with name
- Error creating bean with name
- Error creating bean with name
- spring 错误 Invalid bound statement (not found) 和 Error creating bean with name 'sqlSessionFactory'
- Hibernate的Error creating bean with name 'sessionFactory' defined 。。。错误
- spring整合jbpm Error creating bean with name 'departmentServiceImpl':
- spring注入出现 Error creating bean with name
- spring-data-mongo :Error creating bean with name 'indexCreationHelper':
- Spring ...BeanCreationException: Error creating bean with name 'sqlSessionFactoryWrite'
- Spring 报错:Error creating bean with name的解决方法
- Spring 报错:Error creating bean with name
- Error creating bean with name 'xxxx': Injection of autowired dependencies failed;
- org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxxx'
- 【bzoj3226】[Sdoi2008]校门外的区间
- Android模版化编程系列(一)
- Android 发布版本名字
- 同步异步的区别
- 关于calltree在ubuntu14.04上的安装问题
- spring(错误二) Error creating bean with name 'xxxx'
- UNIX基础知识之出错处理
- 字符串-拼写检查(数据结构基础 第4周)
- jQuery - serialize() 方法
- 卡方检验 2016.07.05回顾
- 查询距离当前时间5分钟的数据
- ACM比赛中如何加速c++的输入输出?如何使cin速度与scanf速度相当?什么是最快的输入输出方法?,cinscanf
- https和证书
- 两个栈实现一个队列 && 两个队列实现一个栈