@Transactional 和 @Async 同时使用时,事务失效了,请问是为什么?代码如下:
@Service
public class AopProxyOrderServiceImpl implements AopProxyOrderService {
@Autowired
private AopProxyOrderService aopProxyOrderService;
@Transactional
@Override
@Async
public void crateOrder(String name) {
AopProxyOrderService proxyOrderService = (AopProxyOrderService)AopContext.currentProxy();
System.out.println("获取代理对象 proxyOrderService ="+proxyOrderService);
System.out.println("我是目标方法 crateOrder,我被调用了...");
}
}