title: Setting JTA Properties to an Atomikos + Spring Boot Configuration
body: <p>I'm trying to set an Atomikos JTA Property (e.g. com.atomikos.icatch.max_timeout) in a Spring Boot Configuration, using the following:</p>
  
  <pre><code>import com.atomikos.icatch.config.UserTransactionServiceImp;
  import com.atomikos.icatch.jta.UserTransactionImp;
  import com.atomikos.icatch.jta.UserTransactionManager;
  
  import java.util.Properties;
  
  import javax.transaction.TransactionManager;
  import javax.transaction.UserTransaction;
  
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.context.annotation.DependsOn;
  import org.springframework.transaction.PlatformTransactionManager;
  import org.springframework.transaction.annotation.EnableTransactionManagement;
  import org.springframework.transaction.jta.JtaTransactionManager;
  
  @Configuration
  @EnableTransactionManagement
  public class TransactionManagementConfiguration 
  {
  
      @Bean(name="userTransactionServiceImp")
      public UserTransactionServiceImp userTransactionServiceImp()
      {
          Properties properties = new Properties();
          properties.setProperty("com.atomikos.icatch.max_timeout", "600000");
          UserTransactionServiceImp userTransactionServiceImp = new UserTransactionServiceImp(properties);
          return userTransactionServiceImp;
      }
  
      @Bean
      @DependsOn("userTransactionServiceImp")
      public UserTransaction userTransaction()
      {
          UserTransactionImp userTransactionImp = new UserTransactionImp();
          return userTransactionImp;
      }
  
      @Bean
      @DependsOn("userTransactionServiceImp")
      public TransactionManager userTransactionManager()
      {
          UserTransactionManager userTransactionManager = new UserTransactionManager();
          userTransactionManager.setStartupTransactionService(false);
          userTransactionManager.setForceShutdown(false);
          return userTransactionManager;
      }
  
      @Bean
      public PlatformTransactionManager transactionManager()
      {
          return new JtaTransactionManager(userTransaction(), userTransactionManager());
      }    
  
  }
  </code></pre>
  
  <p>However, the property setting change to com.atomikos.icatch.max_timeout is not picked up.</p>
  
  <pre><code>2015-09-23 14:31:33.810  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING core version: 3.9.3
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.automatic_resource_registration = true
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.client_demarcation = false
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.threaded_2pc = false
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.serial_jta_transactions = true
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.serializable_logging = true
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.log_base_dir = .\
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.max_actives = 50
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.checkpoint_interval = 500
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.enable_logging = true
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.output_dir = .\
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.log_base_name = tmlog
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.max_timeout = 300000
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.tm_unique_name = 127.0.0.1.tm
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING java.naming.factory.initial = com.sun.jndi.rmi.registry.RegistryContextFactory
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING java.naming.provider.url = rmi://localhost:1099
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.service = com.atomikos.icatch.standalone.UserTransactionServiceFactory
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.force_shutdown_on_vm_exit = false
  2015-09-23 14:31:33.811  INFO 4748 --- [nio-8080-exec-1] c.a.i.c.i.AbstractUserTransactionService : USING com.atomikos.icatch.default_jta_timeout = 10000
  </code></pre>
  
  <p>I've read through the limited JTA Spring Boot materials (<a href="http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-jta.html" rel="noreferrer">http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-jta.html</a>), search on Atomokis, etc. with no luck on what I might be doing wrong.</p>
  
  <p>Have been using the following Atomikos Spring JTA documentation has a guideline for the Spring Boot configuration code:  <a href="http://www.atomikos.com/Documentation/SpringIntegration#The_Advanced_Case_As_of_3_3" rel="noreferrer">http://www.atomikos.com/Documentation/SpringIntegration#The_Advanced_Case_As_of_3_3</a> </p>
  
  <p>Any insight into this problem would be appreciated.</p>
  
  <p>EDIT:  changing the @Bean initMethod/destroyMethod, and adding an @DependsOn to transactionManager() seems to have fixed the issued:</p>
  
  <pre><code>    @Bean(name="userTransactionServiceImp", initMethod = "init", destroyMethod = "shutdownForce")
      public UserTransactionServiceImp userTransactionServiceImp()
      {
          Properties properties = new Properties();
          properties.setProperty("com.atomikos.icatch.max_timeout", "3600000");
          UserTransactionServiceImp userTransactionServiceImp = new UserTransactionServiceImp(properties);
          return userTransactionServiceImp;
      }
  
      @Bean
      @DependsOn("userTransactionServiceImp")
      public UserTransaction userTransaction()
      {
          UserTransactionImp userTransactionImp = new UserTransactionImp();
          return userTransactionImp;
      }
  
      @Bean(initMethod = "init", destroyMethod = "close")
      @DependsOn("userTransactionServiceImp")
      public TransactionManager userTransactionManager()
      {
          UserTransactionManager userTransactionManager = new UserTransactionManager();
          userTransactionManager.setStartupTransactionService(false);
          userTransactionManager.setForceShutdown(false);
          return userTransactionManager;
      }
  
      @Bean
      @DependsOn("userTransactionServiceImp")
      public PlatformTransactionManager transactionManager()
      {
          return new JtaTransactionManager(userTransaction(), userTransactionManager());
      }
  </code></pre>