Java System.setProperties可能会影响其他代码

MeI*_*eIr 6 java properties system

最近我将一段代码集成到现有项目中.但是,为了使代码能够在以下属性中设置:

System.setProperty("javax.xml.soap.MessageFactory","com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl");
System.setProperty("javax.xml.soap.SOAPFactory","com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPFactory1_1Impl");
System.setProperty("javax.xml.soap.MetaFactory","com.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl");

System.setProperty("weblogic.security.SSL.enforceConstraints","off");
System.setProperty("weblogic.security.SSL.ignoreHostnameVerification","true");
System.setProperty("weblogic.security.SSL.strictcertchecking","false");
System.setProperty("weblogic.security.SSL.nojce","true");
Run Code Online (Sandbox Code Playgroud)

现在一切似乎运作良好,但我有一个很大的担忧.

1)以上属性是否会破坏巨大应用程序中其他地方的功能?

2)我可以设置一些特定于我的对象的属性吗?这意味着我不必为了获得相同的结果而设置系统范围的属性.

dar*_*rdo 2

相信系统将与 JVM 的运行联系在一起。如果我正确理解您的问题,您想知道这是否会影响其他地方的功能。

如果您加载另一个应用程序,而该应用程序依赖于同一 JVM 中上面设置的属性,则可能会影响功能。

IE

System.setProperty("weblogic.security.SSL.enforceConstraints","on");
Run Code Online (Sandbox Code Playgroud)

在不同的应用程序中设置。另一件需要担心的事情是这些属性是否在部署时设置,然后被认为是不可变的?如果它们被访问和更改,并且其他应用程序也在访问和更改,则会出现混乱。

希望这是有道理的。