Я запускаю приложение J2SE, которое использует Atomikos, который выводит, это - многочисленные файлы журнала к текущему каталогу. Я хотел бы переместить местоположение этих файлов к "/tmp", но я не могу определить местоположение свойства конфигурации, что я могу установить из своего Spring файл конфигурации XML.
Документация Atomikos ссылается на свойство:
com.atomikos.icatch.output_dir
Который кажется точно, в чем я нуждаюсь, но как установить от Spring его без jta.properties файла? Вот моя конфигурация менеджера транзакций:
<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager">
<property name="transactionManager" ref="atomikosTransactionManager" />
<property name="userTransaction" ref="atomikosUserTransaction" />
</bean>
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close">
<!-- When close is called, should we force transactions to terminate? -->
<property name="forceShutdown" value="false" />
</bean>
<bean id="atomikosUserTransaction" class="com.atomikos.icatch.jta.UserTransactionImp">
<!-- Number of seconds before transaction timesout. -->
<property name="transactionTimeout" value="30" />
</bean>
Данное свойство должно быть установлено на синглтоне экземпляра transactionService - объекте, который обычно создается по требованию менеджером транзакций пользователя:
<bean id="userTransactionService" class="com.atomikos.icatch.config.UserTransactionServiceImp"
init-method="init" destroy-method="shutdownForce">
<constructor-arg>
<!-- IMPORTANT: specify all Atomikos properties here -->
<props>
<prop key="com.atomikos.icatch.service">com.atomikos.icatch.standalone.UserTransactionServiceFactory</prop>
<prop key="com.atomikos.icatch.output_dir">target/</prop>
<prop key="com.atomikos.icatch.log_base_dir">target/</prop>
</props>
</constructor-arg>
</bean>
Теперь свойство установлено. Но для того, чтобы убедиться, что у вас не запущено две службы транзакций, вы должны также изменить боб менеджера транзакций пользователя следующим образом:
<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager"
init-method="init" destroy-method="close" depends-on="userTransactionService">
<!-- When close is called, should we force transactions to terminate? -->
<property name="forceShutdown" value="false" />
<!-- Do not create a transaction service as we have specified the bean in this file -->
<property name="startupTransactionService" value="false" />
</bean>