title: Spring Boot : CrudRepository methods being @Transactional, my service can't be
body: <p>I have a Spring Boot application and I face a weird issue.</p>
  
  <p>I try to make one of my service method transactional but this doesn't work.</p>
  
  <p>My service looks like this : 
  </p>
  
  <pre><code>@Service("ppService")
  public class PlanProgresServiceImpl implements PlanProgresService
  {
      @Resource
      private DeploiementDAO deploiementDao;
  
      ...
  
      @Override
      @Transactional(rollbackFor = TechnicalErrorException.class)
      public Set&lt;String&gt; deployer(PlanProgresType planProgresType, List&lt;Integer&gt; listIdUo, boolean sharepoint, Campagne campagne)
              throws TechnicalErrorException
  
          ...
  
          createDeploiement(deploiement);
  
          throw new TechnicalErrorException("temporary exception to test the transactional behavior");
      }
  
  
      @Override
      public void createDeploiement(Deploiement deploiement)
      {
          deploiementDao.save(deploiement);
      }
  }
  </code></pre>
  
  <p>And here is my DAO :</p>
  
  <pre><code>public interface DeploiementDAO extends CrudRepository&lt;Deploiement, Integer&gt;
  {
      List&lt;Deploiement&gt; findByUniteOperationnelle(UniteOperationnelle uo);
  }
  </code></pre>
  
  <p>The thing is that my Deploiement object is always inserted in database (a PostgreSQL one).</p>
  
  <p>I have added the following line in my application.yml <code>logging.level.org.springframework.transaction.interceptor: TRACE</code></p>
  
  <p>And it gives me this in the console :</p>
  
  <pre><code>2017-05-02 19:38:24.297 TRACE 7760 --- [io-8080-exec-79] o.s.t.i.TransactionInterceptor           : Getting transaction for 
  [org.springframework.data.jpa.repository.support.SimpleJpaRepository.findOne]
  2017-05-02 19:38:24.310 TRACE 7760 --- [io-8080-exec-79] o.s.t.i.TransactionInterceptor           : Completing transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.findOne]
  2017-05-02 19:38:24.312 TRACE 7760 --- [io-8080-exec-79] o.s.t.i.TransactionInterceptor           : Getting transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.findOne]
  2017-05-02 19:38:24.323 TRACE 7760 --- [io-8080-exec-79] o.s.t.i.TransactionInterceptor           : Completing transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.findOne]
  2017-05-02 19:38:24.324 TRACE 7760 --- [io-8080-exec-79] o.s.t.i.TransactionInterceptor           : Don't need to create transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.findByUniteOperationnelle]: This method isn't transactional.
  2017-05-02 19:38:24.449 TRACE 7760 --- [io-8080-exec-79] o.s.t.i.TransactionInterceptor           : Getting transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]
  2017-05-02 19:38:24.450 TRACE 7760 --- [io-8080-exec-79] o.s.t.i.TransactionInterceptor           : Completing transaction for [org.springframework.data.jpa.repository.support.SimpleJpaRepository.save]
  </code></pre>
  
  <p>Which means that every methods of SimpleJpaRepository are transactional, that is true when we look at its code :</p>
  
  <pre><code>@Transactional
  public &lt;S extends T&gt; S save(S entity) {
  
      if (entityInformation.isNew(entity)) {
          em.persist(entity);
          return entity;
      } else {
          return em.merge(entity);
      }
  }
  </code></pre>
  
  <p>So, how can I solve this ?</p>