Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jrebel修改后调用toString方法报错问题 #2231

Open
liyikai opened this issue Jan 9, 2019 · 5 comments
Open

jrebel修改后调用toString方法报错问题 #2231

liyikai opened this issue Jan 9, 2019 · 5 comments

Comments

@liyikai
Copy link

liyikai commented Jan 9, 2019

通过AOP拦截方法参数,在参数增加字段以及get,set后,增加的参数是List集合,调用JSON.toString方法会报找不到get方法。
目前有解决办法吗?

@zgl00838
Copy link

zgl00838 commented Jan 23, 2019

这是因为fastjson对序列化器做了缓存,你参数改变后它还是调用之前的序列化器

@zl7261
Copy link

zl7261 commented May 14, 2019

这是因为fastjson对序列化器做了缓存,你参数改变后它还是调用之前的序列化器,暂时找不到解决方案;你可以用jackson替代

能够禁用缓存达到刷新的效果吗?

@Vant1032
Copy link

可以的,方法如下:

@RestController
@RequestMapping("/api")
public class SystemController {
    @ApiOperation(value = "开发时清除缓存", notes = "用于开发使用JRebel时清除FastJson的对象解析Cache")
    @RequestMapping(value = "/clearCache", method = RequestMethod.GET)
    public String clearCache() {
        SerializeConfig.getGlobalInstance().clearSerializers();
        ParserConfig.getGlobalInstance().clearDeserializers();
        return "";
    }
}

调用该方法即可清除缓存。
可以参见我的博文:解决JRebel进行代码热加载时FastJson的JsonField的缓存无法刷新问题

@rencongjie-qyt1902
Copy link

有没有大神写一个拦截器,,这样每次调接口清除好麻烦呀

@clickear
Copy link

clickear commented Dec 7, 2022

这是因为fastjson对序列化器做了缓存,你参数改变后它还是调用之前的序列化器,暂时找不到解决方案;你可以用jackson替代

能够禁用缓存达到刷新的效果吗?
可以在开发环境,禁用ASM
SerializeConfig.getGlobalInstance().setAsmEnable(false);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants