去掉Atomikos的日志提示信息:没有设置属性文件的路径

 

去掉Atomikos的日志提示信息:没有设置属性文件的路径

 

Setting Atomikos System Properties in Spring

The Spring Bean configuration of the class UserTransactionServiceImp described above can be used to set the Atomikos JTA properties. However there are three JVM (or System) properties that cannot be set through the constructor of the UserTransactionServiceImp class or via any programmatic means. These properties are:

  • com.atomikos.icatch.file
  • com.atomikos.icatch.no_file
  • com.atomikos.icatch.hide_init_file_path

Fortunately, it is possible to set the value of system properties within a Spring configuration file through the use of Spring's MethodInvokingFactoryBean class. For example:

<bean id="setMyAtomikosSystemProps"
      class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
        <property name="targetObject">
            <!-- System.getProperties() -->
            <bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
                <property name="targetClass" value="java.lang.System" />
                <property name="targetMethod" value="getProperties" />
            </bean>
        </property>
        <property name="targetMethod" value="putAll" />
        <property name="arguments">
            <!-- The new Properties -->
            <props>
                <prop key="com.atomikos.icatch.file">/etc/myapp/jta.properties</prop>
                <prop key="com.atomikos.icatch.hide_init_file_path">true</prop>
            </props>
        </property>
    </bean>

In order for this to work, the Atomikos beans must add the Spring attribute "depend-on=" and add the Id of this bean. This will ensure the system property values are set prior to the initialization of Atomikos.

 

在spring的配置文件中添加上方的代码,然后在Atomikos beans中加入 "depend-on=setMyAtomikosSystemProps",就可以了。

 

以上信息,仅供参考,希望对您有所帮助。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值