缓存预热:fasterxml.jackson的InitializingBean

凡是实现这个InitializingBean都需要实现afterPropertiesSet方法,这个方法会在bean创建完,autowired注入后执行。这样就可以在项目启动好后再执行了,实现缓存预热的效果。

ObjectMapper是Spring默认的json处理工具,它作序列化用到的是writeValueAsString这个方法。

posted @ 2023-06-27 15:26  xycccode  阅读(18)  评论(0编辑  收藏  举报