@Service
public class StudentServiceImpl implements StudentService {
@Autowired
private StudentDao studentDao;
@Transactional
@Override
public void save1() {
StudentDO studentDO = new StudentDO("zhang1");
StudentDO result = studentDao.save(studentDO);
StudentService service = SpringUtils.getBean(StudentService.class);
try {
service.save2();
} catch (Exception e) {
System.err.println(e.getMessage());
}
}
@Transactional
@Override
public void save2() {
int i = 1 / 0;
}
}