Grails版本:2.3.8我在BootStrap.groovy中注册了一个自定义日期封送器,但是当我使用将日期填充为Json的对象时,它将抛出一个异常:异常消息是
ClassCastException: grails.converters.JSON cannot be cast to grails.converters.XML.BootStrap.goovy
def customDateMarshaller = new DateMarshaller(FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss'Z'",TimeZone.getDefault(), Locale.getDefault()))
def init = { servletContext ->
JSON.registerObjectMarshaller(customDateMarshaller)`
}发布于 2014-11-06 07:37:25
这是我的问题。有两个类具有相同的简单类名DateMarshaller。一个是'org.codehaus.groovy.grails.web.converters.marshaller.xml.DateMarshaller',另一个是'org.codehaus.groovy.grails.web.converters.marshaller.json.DateMarshaller'.We应该使用第二个而不是第一个
https://stackoverflow.com/questions/26622535
复制相似问题