Spring bean无法解析org.joda.time.DateTime的构造函数

Dheerendra

我正在注入构造函数以org.joda.time.DateTime使用spring作为

<bean id="myDateTime" class="org.joda.time.DateTime">
    <constructor-arg type="java.lang.Long" value="${startDateTime:#{null}}" />
</bean>

startDateTime解析为1341571102000但是我收到关于无法解析构造函数的错误

Cannot resolve reference to bean 'myDateTime' while setting constructor argument; 
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myDateTime' defined in URL [file:/path/to/spring-configuration/application-config.xml]: Could not resolve matching constructor (hint: specify index/type/name arguments for simple parameters to avoid type ambiguities)
埃尔兰森

org.joda.time.DateTime类没有接受一个构造函数java.lang.Long您可能想要使用接受原始的那个long要做到这一点,尝试指定type="long"constructor-arg

但是,null在这种情况下startDateTime,无法设置万一的后备状态将不起作用。我不确定这种后备的目的是什么,但是如果要使用long构造函数,则需要以其他方式解决

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Joda Time / Jackson 2 / Spring的反序列化问题-无法实例化类型的值[简单类型,类org.joda.time.DateTime]

Spring Boot 中从 org.joda.time.Interval 迁移

Jodatime:无法解析导入的org.joda.time.Weeks

java.lang.NoClassDefFoundError:org.joda.time.DateTime

解析Joda-Time部分

Joda Time LocalDate(对象即时,DateTimeZone区域)构造函数的目的

无法从 JSON 字符串实例化 [简单类型,类 org.joda.time.LocalDateTime] 类型的值;没有单字符串构造函数/工厂方法

如何从org.joda.time.DateTime转换为java.time.ZonedDateTime

Spring Tool Suite org.joda 在 Gradle 项目中无法解析

尝试使用 gradle-swagger-generator-plugin 生成代码时获取 java.lang.NoSuchMethodError: org.joda.time.DateTime.now()Lorg/joda/time/DateTime

Joda-Time DateTime更改时区?

与Joda Time DateTime#centuryOfEra()的混淆

如何使用 Scala 在 Spark Streaming 中序列化 org.joda.time.DateTime?

数据截断:错误的日期时间值:org.joda.time.DateTime

Jenkins 2.190.2传递管道视图java.lang.NoClassDefFoundError:org / joda / time / DateTime

java.lang.RuntimeException:不支持的文字类型类org.joda.time.DateTime

排序Seq [scala.collection.immutable.Map [String,org.joda.time.DateTime]]

MySQL DATETIME精度(joda-time,Hibernate,org.jadira.usertype,hbm2ddl)

使用Joda Time解析冗余信息

带有Joda DateTime的Spring Integration的ObjectToMapTransformer

Spring Runtime Error-设置构造函数参数时无法解析对bean'entityManagerFactory'的引用

在JPA / hibernate和spring中使用joda time

将org.joda.time转换为java.time

joda-time ISODateTimeFormat.dateTime()行为异常

从Joda-Time DateTime获取java.util.Date

joda.time.DateTime反序列化错误

比较两个Joda-Time DateTime对象

在Joda-Time中,将DateTime设置为月初

Joda-Time:DateTime,DateMidnight和LocalDate的用法