title: Order of Spring @Transactional and Spring Security @PreAuthorize
body: <p>So I have something like the following:</p>
  
  <pre><code>public interface  MyService {
  
      @PreAuthorize("hasPermission(T(Name).OBJ, T(Action).GET)")
      MyObj getObj(String id);
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@Service
  public class MyServiceImpl implements MyService {
  
      @Override
      @Transactional
      public MyObj getObj(String id){
  
          return dao.get(id);
      }
  }
  </code></pre>
  
  <hr>
  
  <pre><code>@Controller
  public class MyController {
  
      @Resource(name="myServiceImpl")
      private MyService service;
  
      public MyObj getObj(String id){
  
         return service.getObj(id);
      }
  }
  </code></pre>
  
  <p>When the method <code>getObj(id)</code> is called, everything is wrapped in a transaction first, then authorization is checked. Is is possible to keep this configuration and first get Spring to check for authorization, then create the transaction if the user is authorized?</p>
  
  <p>I've spent a good deal searching for an answer and could not find anything.</p>