Well, JAX-RS relies on the Service Provider convention.
On the first lines of the newBuilder
method you can read:
Object delegate = FactoryFinder.find(JAXRS_DEFAULT_CLIENT_BUILDER_PROPERTY,
JAXRS_DEFAULT_CLIENT_BUILDER);
Where JAXRS_DEFAULT_CLIENT_BUILDER_PROPERTY
is "javax.ws.rs.client.ClientBuilder"
In turn, FactoryFinder
looks
- first for the class name into
META-INF/services/javax.ws.rs.client.ClientBuilder
- then in the property
javax.ws.rs.client.ClientBuilder
into ${java.home}/lib/jaxrs.properties
- finally into the System property
javax.ws.rs.client.ClientBuilder
.
So, to use RESTEasy, you should create a file
META-INF/services/javax.ws.rs.client.ClientBuilder
with the text:
org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder
which is the class name of the RESTEasy ClientBuilder
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…