为了账号安全,请及时绑定邮箱和手机立即绑定

Spring为什么不能注入TreeSet?

Spring为什么不能注入TreeSet?

菠萝1230 2017-08-03 14:51:26
八月 03, 2017 2:50:16 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@2ff5659e: startup date [Thu Aug 03 14:50:15 CST 2017]; root of context hierarchy八月 03, 2017 2:50:16 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions信息: Loading XML bean definitions from class path resource [beans_jihe.xml]八月 03, 2017 2:50:16 下午 org.springframework.context.support.ClassPathXmlApplicationContext refresh警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'javaCollection' defined in class path resource [beans_jihe.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.LinkedHashSet' to required type 'java.util.TreeSet' for property 'addressSet'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.util.LinkedHashSet' to required type 'java.util.TreeSet' for property 'addressSet': no matching editors or conversion strategy found
查看完整描述

2 回答

已采纳
?
按照自己的节奏前行

TA贡献90条经验 获得超70个赞

nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.util.LinkedHashSet' to required type 'java.util.TreeSet' for property 'addressSet'
//看这一句,类型转化不支持,应该是使用<set></set>的时候默认寻找的LinkedHashSet,或许spring 本身不支持
//或许标签不对


查看完整回答
1 反对 回复 2017-08-04
  • 2 回答
  • 0 关注
  • 1892 浏览

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信