Property of ‘java.util.Set‘ type cannot be injected by ‘List’

在自定义日期转换器的时候出现以下错误:

Property of 'java.util.Set<?>' type cannot be injected by 'List'

`

<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
    <property name="converters">
        <list list-class="java.util.ArrayList">   <!--如果使用<list>此处报错,Property of 'java.util.Set<?>' type cannot be injected by 'List'-->
            <bean class="com.shop.controller.converter.CustomDateConverter"/>
        </list>
    </property>
</bean>

`

改为
`

<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
    <property name="converters">
        <util:list list-class="java.util.ArrayList">
            <bean class="com.shop.controller.converter.CustomDateConverter"/>
        </util:list>
    </property>
</bean>

`
即可

发表评论

电子邮件地址不会被公开。 必填项已用*标注