Spring方法如果用@Transactional注释它没有被调用

时间:2014-11-27 12:15:07

标签: transactions spring-transactions

控制器代码 @Autowired     私人AdNetworkPlacementService adNetworkPlacementService;

@POST
@Produces("application/json")
@Consumes("application/json")
public AdNetworkPlacement createPlacement(@QueryParam("pubId") Long publisherId, AdNetworkPlacement placement)
        throws APIException {

    return adNetworkPlacementService.createNonIntegratedAdNetworkPlacement(116l, publisherId, placement);
}

方法代码

@Transactional(rollbackFor = Exception.class)
    public AdNetworkPlacement createNonIntegratedAdNetworkPlacement(Long userId, Long publisherId, AdNetworkPlacement placement) throws APIException {
}

添加@Transactional

时,不会调用该方法

评论它运作良好

1 个答案:

答案 0 :(得分:0)

问题解决了

这是context-component:scan

的问题

需要指定完整的包结构