HDa*_*ave 2 spring stderr atomikos
通过 Spring 配置 Atomikos 时,不需要 jta.properties 或 transactions.properties 文件。尽管如此,Atomikos 启动时会打印以下消息到 stderr:
No properties path set - looking for transactions.properties in classpath...
transactions.properties not found - looking for jta.properties in classpath...
Failed to open transactions properties file - using default values
Run Code Online (Sandbox Code Playgroud)
它使它看起来好像没有使用 Spring 配置——尽管显然一切都很好。有谁知道如何摆脱这个,所以我最终不会被问到 1.000 次?
有没有办法从特定组件或 jar 重定向 stderr?
您需要将系统属性设置com.atomikos.icatch.hide_init_file_path为任何值。在 java 命令行上执行此操作。在 maven 中,您可以通过将命令行 arg 传递给 surefire 来执行此操作,如下所示:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Dcom.atomikos.icatch.hide_init_file_path=true</argLine>
</configuration>
</plugin>
Run Code Online (Sandbox Code Playgroud)
更新:从 Spring 配置文件中,您可以像这样设置属性:
<bean id="atomikosSystemProps" 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 -->
<util:properties>
<prop key="com.atomikos.icatch.hide_init_file_path">true</prop>
</util:properties>
</property>
</bean>
Run Code Online (Sandbox Code Playgroud)
只要记住让你的 Atomikos bean“依赖”这个 bean,这样实例化的顺序是正确的。
| 归档时间: |
|
| 查看次数: |
2550 次 |
| 最近记录: |