我只是想知道类的事务方法与另一类的事务方法/非事务方法之间的区别。
选项A:
@Service
class EmployeeService {
@Autowired
Addressdao addressDao;
@Transactional
void insert(Address address) {
addressDao.insert(address);
}
}
@Service
class AddressDao {
@Autowired
JdbcTemplate jdbcTemplate;
@Transactional
void insert(Address address) {
jdbcTemplate.insert(address);
}
}
选项B:
@服务 EmployeeService {
类@Autowired
Addressdao addressDao;
@Transactional
void insert(Address address) {
addressDao.insert(address);
}
}
@服务
class AddressDao {
@Autowired
JdbcTemplate jdbcTemplate;
void insert(Address address) {
jdbcTemplate.insert(address);
}
}