title: @Async and @Transactional
body: <p>Question about @Transactional working in @Async working</p>
  <p>This is a code sketch for an example:</p>
  <pre><code>@Async
  @Transactional
   public void data(List&lt;Pass&gt; pass) {
          //code
          for(City city : city) {
              for(Dep dep: city.getDeps()) {
                  //code
                  setXor(user, xor);
                  //code
              }
          }
      }
  
  
  @Transactional
  public void setXor(User user, Xor xor) {
          //code
          user.setXor(xor);
      }
  </code></pre>
  <p>The question is, how will this work, does @Transactional extend from the data method to the setXor method (if you put an annotation on the data method, then maybe you don’t need to put it on setXor? And it will automatically switch to this method)</p>
  <p>Also a question about @Async, will setXor work on a new thread along with Async? That is, there will be a main thread, a new one is created, which includes the data method, and since the data method called another method, it will be executed on the same thread as the data method, there will be no third thread. Or vice versa and the setXor method is executed in the main thread?</p>