`
wenjinglian
  • 浏览: 822276 次
  • 性别: Icon_minigender_1
  • 来自: 株洲->深圳
社区版块
存档分类
最新评论

Failed to convert property value of type 'java.util.LinkedHashMap' to required

阅读更多
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'payCallbackHandler' defined in URL [file:/E:/workspace/pay-biz/webapp/WEB-INF/classes/applicationContext_pay.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMisma
tchException: Failed to convert property value of type 'java.util.LinkedHashMap' to required type 'java.util.Map' for property 'payMerIdParamMap'; nested exception is java.lang.NumberFormatException: For input string: "yeepay"
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:269)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:876)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:735)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
        ... 32 more

 

先检查类中Map需要注入的类型有没有写错,spring的注入会自动检测类型,自动匹配map的泛型定义类型.

我出错的原因是自己类型写错了。下面的方法用不上。

解决办法,指定map类型,默认LinkedHashMap

<bean id="beanName" class="package.xxx.xxx.Class">
        <property name="data">
            <bean class="java.util.HashMap">
            <constructor-arg> 
            <map>
                ....................
            </map>
            </constructor-arg>
            </bean>
        </property>
    </bean>

 

来源:http://hi.baidu.com/songxy888/item/768315ff1e60c41fe2e3bdf5

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics