spring boot 和 spring 依赖循环错误,错误信息中有类似:its raw version as part of a circular reference

经错误信息定位到依赖循环之间的类如下

'activityServiceImpl'>'goodServiceImpl'>'goodCarServiceImpl'>'luceneServiceImpl'>'storeServiceImpl'>'appUserServiceImpl'

>'creditServiceImpl'>'orderFormServiceImpl'>'teamServiceImpl'>'orderServiceImpl'>'orderAsynchronousServiceImpl'

在最后的orderAsynchronousServiceImpl发现调用refundService,而refundService中存在refundService引用'orderFormService,

orderFormService中引用了refundService的情况,最终确定是refundService与orderFormService之间的互相调用导致的系统循环依赖,将refundService中引用orderFormService的那个方法函数,转移到与orderFormService没有互相引用关系的类中,我是移到orderFormService中,破坏循环链。重新启动项目以后即成功运行了。

/**
 * 对拼团订单进行退款
 */
@Override
@Async
public void refundTeamOrder(BigDecimal price, String orderId, Long userId, Integer refundType, Integer refundStatus, Long goodCartId, Long storeId, Integer pay_way) {
    Long rId = refundService.insertRefundByJdbc(price, 0, orderId, userId, refundType, refundStatus, goodCartId, storeId, pay_way,2,1,new BigDecimal(0),null,null,null,null);
    Boolean refundSuccess = refundService.gadgetRefund(rId);
    if (refundSuccess) {//退款成功
        orderFormService.modifyOrderStatus(null, orderId, OrderStatusEnum.REFUND_SUCCESS.getCode(), "系统退款成功");//更变订单状态
        //发送模板消息
        orderMessageService.seedRefundSuccessMsg(appUserService.searchUserInfoByUserIdOrOrderId(userId.toString()).getOpenid(), orderId, orderService.getGoodCartByOrderId(orderId).get(0).getGoods_name(), price, RefundTypeEnum.getReasonByCode(refundType));
    }
}

}

你可能感兴趣的:(IT,mysql)