@Test public void testMethod01() { orderService.method01(); }
public void method01() { OrderDO order = orderMapper.selectById(1); System.out.println(order); UserDO user = userMapper.selectById(1); System.out.println(user); }
OrderService { public void method01() { OrderDO order = orderMapper.selectById(1); System.out.println(order); UserDO user = userMapper.selectById(1); System.out.println(user); } }
OrderService { public void method01() { OrderDO order = orderMapper.selectById(1); System.out.println(order); UserDO user = userMapper.selectById(1); System.out.println(user); }  }
OrderService { public void method01() { OrderDO order = orderMapper.selectById(1); System.out.println(order); UserDO user = userMapper.selectById(1); System.out.println(user); }  void method01(); @Transactional void method02(); void method03(); @Transactional // 报错，因为此时获取的是 primary 对应的 DataSource ，即 users 。 void method031(); @Transactional void method032(); void method04(); @Transactional @DS(DBConstants.DATASOURCE_ORDERS) void method041(); @Transactional @DS(DBConstants.DATASOURCE_USERS) void method042(); @Transactional @DS(DBConstants.DATASOURCE_ORDERS) void method05(); @Transactional(propagation = Propagation.REQUIRES_NEW) @DS(DBConstants.DATASOURCE_USERS) void method052(); }
OrderService { public void method01() { OrderDO order = orderMapper.selectById(1); System.out.println(order); UserDO user = userMapper.selectById(1); System.out.println(user); }  void method01(); @Transactional void method02(); void method03(); @Transactional // 报错，因为此时获取的是 primary 对应的 DataSource ，即 users 。 void method031(); @Transactional void method032(); void method04(); @Transactional @DS(DBConstants.DATASOURCE_ORDERS) void method041(); @Transactional @DS(DBConstants.DATASOURCE_USERS) void method042(); @Transactional @DS(DBConstants.DATASOURCE_ORDERS) void method05(); @Transactional(propagation = Propagation.REQUIRES_NEW) @DS(DBConstants.DATASOURCE_USERS) void method052();  }