zoukankan      html  css  js  c++  java
  • 使用SpringMVC报错 Error creating bean with name 'conversionService' defined in class path resource [springmvc.xml]

    使用SpringMVC报错 Error creating bean with name 'conversionService' defined in class path resource [springmvc.xml]

    Could not instantiate bean class [org.springframework.core.convert.support.ConversionServiceFactory]:

    Error creating bean with name '(inner bean)': Cannot resolve reference to bean 'conversionService' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'conversionService' defined in class path resource [springmvc.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.core.convert.support.ConversionServiceFactory]: Is it an abstract class?; nested exception is java.lang.InstantiationException。

    仔细检查是springmvc.xml中的bean中的class引入错误的类了。比如原来是这样的:

    <bean id="conversionService"
            class="org.springframework.core.convert.support.ConversionServiceFactory">
            <property name="converters">
                <set>
                    <ref bean="employeeConverter"/>
                </set>
            </property>
    </bean>

    正确的应该下面这样

    <bean id="conversionService"
            class="org.springframework.context.support.ConversionServiceFactoryBean">
            <property name="converters">
                <set>
                    <ref bean="employeeConverter"/>
                </set>
            </property>
    </bean>

    修改成这样就不会报错了。

  • 相关阅读:
    java创建节点和单向链表
    Java循环链表实现约瑟夫环(搬运)
    java语言建立顺序表
    顺序表删除重复值的高效算法。
    2016.1.29
    IO流学习笔记
    oracle 计算两个时间之间的月份差,相差几个星期,相差多少天
    java中如何计算两个时间段的月份差
    怎样在数据库中插入大量数据
    oracle 定义数据完整性
  • 原文地址:https://www.cnblogs.com/liaoxiaolao/p/10009883.html
Copyright © 2011-2022 走看看