我在过滤器中使用GSON类型转换器如下...
def account = new Object(){
String firstName, lastName
};
if(springSecurityService.isLoggedIn()){
account.setFirstName(springSecurityService.principal.givenName);
account.setLastName(springSecurityService.principal.familyName);
}
String test = account as GSON;
但是测试总是为空,即使对象填充正确也是如此。我不喜欢普通JSON序列化程序中的所有额外数据。那么有谁知道为什么这不起作用?
更新
转换为JSON时,我得到以下内容......
Caused by: java.lang.IllegalAccessException: Class org.codehaus.groovy.grails.web.converters.marshaller.json.GenericJavaBeanMarshaller can not access a member of class org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor with modifiers "public"