I'm trying to get a Spring MVC Controller method which has been annotated with @Transactional to rollback if the network cable in pulled on the client before the method returns, I just can't seem to get it to work, here is an example of what I'm trying to achieve.
@Transactional(rollbackFor = IOException.class)
@RequestMapping(value = "/test")
public @ResponseBody
Integer testMethod(HttpServletResponse response) throws Exception {
LOG.debug("Put breakpoint here, and pull network cable on client...");
//IMHO this should throw an IOException, but it isn't doing?
response.getOutputStream();
return 10;
}
So if I put a breakpoint on the logging statement, then unplug the network cable on the client then play, I would of expected to get an IOException from response.getOutputStream(), but this is not the case, any help will be much appreciated?