java.lang.invode.SerializedLambda’ culd not be instantiated
架构:dubbo + mybatisPlus
事情是这样的:
有个关注功能
在关注之后需要异步去添加关注数
@JmsListener(destination = ActiveMqConstant.ADD_FOLLOW)
public void asynchronousAddFabulous(Follow follow) {
Organization organization = organizationService.getOrganizationByCode(follow.getFollowCode());
organization.setFollowCount(organization.getFollowCount() + 1);
UpdateWrapper<Organization> wrapper = new UpdateWrapper<>();
wrapper.eq("code", organization.getCode());
// 这里使用的mybatisPlus
organizationService.update(organization, wrapper);
}
这个时候 因为OrganizationService 跟 当前不在同一个服务,需要将wrapper 序列化 转至OrganizationService 这个服务
出现这个错误:
通过查询得知:wrapper不支持也不推荐进行dubbo传递
所以这个时候,我们只需要将:
UpdateWrapper<Organization> wrapper = new UpdateWrapper<>();
wrapper.eq("code", organization.getCode());
// 这里使用的mybatisPlus
organizationService.update(organization, wrapper);
这块修改一下:
organizationService.modifyOrganizationByCode(organization);
将这个修改操作交给组织模块去完成,在这里只通过服务调用组织模块,这样就不会将Wrapper 进行传递
问题解决!!!