mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
Merge branch 'v6-dev' of gitee.com:dromara/hutool into v6-dev
This commit is contained in:
commit
162cbfe6d7
@ -76,23 +76,9 @@ public class ClientEngineFactory {
|
|||||||
* @return {@code ClientEngine}
|
* @return {@code ClientEngine}
|
||||||
*/
|
*/
|
||||||
public static ClientEngine createEngine() {
|
public static ClientEngine createEngine() {
|
||||||
final ClientEngine engine = doCreateEngine();
|
// JdkClientEngine托底,始终不空
|
||||||
|
final ClientEngine engine = SpiUtil.loadFirstAvailable(ClientEngine.class);
|
||||||
LogUtil.debug("Use [{}] Http Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
LogUtil.debug("Use [{}] Http Engine As Default.", StrUtil.removeSuffix(engine.getClass().getSimpleName(), "Engine"));
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据用户引入的HTTP客户端引擎jar,自动创建对应的HTTP客户端引擎对象<br>
|
|
||||||
* 推荐创建的引擎单例使用,此方法每次调用会返回新的引擎
|
|
||||||
*
|
|
||||||
* @return {@code EngineFactory}
|
|
||||||
*/
|
|
||||||
private static ClientEngine doCreateEngine() {
|
|
||||||
final ClientEngine engine = SpiUtil.loadFirstAvailable(ClientEngine.class);
|
|
||||||
if (null != engine) {
|
|
||||||
return engine;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new HttpException("No http jar found !Please add one of it to your project !");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user