package com.xiangwen.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.xiangwen.dao1.UserDaoTest1; import lombok.extern.slf4j.Slf4j; @Service @Slf4j public class UserServicer1 { @Autowired private UserDaoTest1 userDaoTest1; @Transactional(transactionManager = "test1TransactionManager") public int adduser(String name, int age) { int res = userDaoTest1.inserUser(name, age); log.info("============进来了UserServer1"); int a = 1 / age; return res; } }