Spring ConversionFailedException: Failed to convert from type java.util.ArrayList to type java.util.List

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

    原文作者:小严
    原文地址: https://www.cnblogs.com/JNUX/p/7457110.html
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞