错误:Property of 'java.util.Set>' type cannot be injected by 'List'的解决方案
程序员文章站
2022-04-25 22:09:53
...
在自定义日期转换器的时候出现以下错误:
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>
`
即可
上一篇: SpringBoot项目单元测试
下一篇: 开发和测试业务逻辑问题集