Spring ConversionFailedException: Failed to convert from type java.util.ArrayList<?> to type java.util.List<org.springframework.core.io.Resource>

org.springframework.core.convert.ConversionFailedException: Failed to convert from type [java.util.ArrayList<?>] to type [java.util.List<org.springframework.core.io.Resource>] 
for value '[/assets/]'; nested exception is org.springframework.core.convert.ConverterNotFoundException:
No converter found capable of converting from type [java.util.ArrayList<?>] to type [org.springframework.core.io.Resource]

原因beanID冲突

源代码样式

    <mvc:annotation-driven conversion-service="conversionService">
        <mvc:message-converters>
            <bean class="org.springframework.http.converter.StringHttpMessageConverter" />
            <bean
                class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
        </mvc:message-converters>
    </mvc:annotation-driven>
    <bean id="conversionService"
        class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
        <property name="formatters">
            <set>
                <bean class="com.ivlo.crm.extend.MyDateFormatter"></bean>
            </set>
        </property>
    </bean>
    <mvc:resources mapping="/assets/**" location="/assets/" />

将conversionService 换一个ID名称 例如 conversionDateService 既可以正常运行了

原因 http://www.cnblogs.com/susua/p/5571590.html

posted @ 2017-08-31 10:47  小严  阅读(1702)  评论(0编辑  收藏  举报