@Transactional
@GetMapping("/add")
public String insert(@ModelAttribute Person model) throws Exception {
model.setBirthday(new Date());
jdbcTemplate.update("insert into stu(name,birthday) values(?,?)",model.getName(),model.getBirthday());
return "success";
}
aop after方法抛错,这时,数据仍然不会写入数据库
@After("pointcut()")
public void afterResult() throws Exception {
System.out.println("after log");
if(System.currentTimeMillis()>100){
// throw new RuntimeException("after test");
throw new Exception("after test");
}
}
```
注:@After中抛出错误,优先于 @AfterThrowing, @AfterReturning,
即,都抛错,打印出@After中的抛错