spring中自定义属性编辑器注入org.springframework.beans.factory.config.CustomEditorConfigurer时报错问题

在Spring中自定义属性编辑器时遇到错误,报错与旧版到新版`CustomEditorConfigurer`的`customEditors`属性变化有关。原本注入的方式不再适用,因为新版本的`customEditors`要求为`Map<Class<?>, Class<? extends PropertyEditor>>`类型。解决方案是更新配置方式以适配新版本的API。" 108756529,9340802,IntelliJ IDEA快捷键设置指南,"['intellij idea', '开发工具', 'IDE']
摘要由CSDN通过智能技术生成

报错信息如下:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'PropertyEditorConfigurer1' defined in class path resource [spring/application-ren.xml]: Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type 'java.util.LinkedHashMap' to required type 'java.util.Map' for property 'customEditors'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type 'renchaofeng_propertyEditor.TestPropertyEditor' to required type 'java.lang.Class' for property 'customEditors[renchaofeng_propertyEditor.Education]': PropertyEditor [org.springframework.beans.propertyeditors.ClassEditor] returned inappropriate value of type 'renchaofeng_propertyEditor.TestPropertyEditor'
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:564)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
	at org.springframework.context.
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值