But I found another way to get that. Instead of using a new DomainClassMarshaller, I just retrieve the DomainClassMarshaller from the ConverterConfiguration. Here is my code:
import org.codehaus.groovy.grails.web.converters.configuration.ConvertersConfigurationHolder as CCH
import org.codehaus.groovy.grails.web.converters.marshaller.json.DomainClassMarshaller as DCM
import grails.converters.JSON
class BootStrap {
def init = { servletContext ->
def cfg= CCH.getConverterConfiguration(JSON.class)
def marshellers= cfg.orderedObjectMarshallers
for(m in marshellers){
if(DCM.class.isAssignableFrom(m.class)){
m.includeVersion= true
break
}
}
}
def destroy = {
}
}Maybe it is not as simple as Sigi's solution, but I think it is the complement to this issue.
No comments:
Post a Comment