how to override a service provider in java

前端 未结 5 2079
不思量自难忘°
不思量自难忘° 2020-12-19 01:42

This is more a general question by example: I\'m using xstream and woodstox, woodstox comes with a service provider for javax.xml.stream.XMLOutputFactory in woodstox jar reg

5条回答
  •  太阳男子
    2020-12-19 02:15

    You can just do like this to specify the XMLOutputFactory implementation You want to use:

    System.setProperty("javax.xml.stream.XMLOutputFactory", ... full classname You want to use ...);
    

    Source: http://docs.oracle.com/cd/E17802_01/webservices/webservices/docs/1.6/tutorial/doc/SJSXP4.html

    Deriving from JAXP, the XMLInputFactory.newInstance() method determines the specific XMLInputFactory implementation class to load by using the following lookup procedure:

    1. Use the javax.xml.stream.XMLInputFactory system property.
    2. Use the lib/xml.stream.properties file in the JRE directory.
    3. Use the Services API, if available, to determine the classname by looking in the META-INF/services/javax.xml.stream.XMLInputFactory files in jars available to the JRE.
    4. Use the platform default XMLInputFactory instance.

提交回复
热议问题