Spring Boot 2.0:WebClient can’t be used alone

Description

In Spring 5.0 WebClient classes are in spring-webflux.jar,which includes classes of both reactive http server and client.
Spring Boot will regard an application as a web server if  “web.reactive.DispatcherHandler”  is in the class path .
So we just can’t use the spring web client functionalities without a web server.

Error

2017-11-01 14:10:13.886 ERROR 5196 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.context.ApplicationContextException: Unable to start reactive web server; nested exception is org.springframework.context.ApplicationContextException: Unable to start ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean.
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:64) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.0.0.RELEASE.jar:5.0.0.RELEASE]
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:49) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:386) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:327) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1245) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1233) [spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at me.changchao.reactive.topfreqwords.TopFreqWordsApplication.main(TopFreqWordsApplication.java:10) [bin/:na]
Caused by: org.springframework.context.ApplicationContextException: Unable to start ReactiveWebApplicationContext due to missing ReactiveWebServerFactory bean.
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.getWebServerFactory(ReactiveWebServerApplicationContext.java:112) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.createWebServer(ReactiveWebServerApplicationContext.java:87) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
	at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.onRefresh(ReactiveWebServerApplicationContext.java:61) ~[spring-boot-2.0.0.M5.jar:2.0.0.M5]
	... 8 common frames omitted

REASON:org.springframework.boot.SpringApplication.deduceWebApplicationType()

private WebApplicationType deduceWebApplicationType() {
  if (ClassUtils.isPresent(REACTIVE_WEB_ENVIRONMENT_CLASS, null)
      && !ClassUtils.isPresent(MVC_WEB_ENVIRONMENT_CLASS, null)) {
    return WebApplicationType.REACTIVE;
  }
  for (String className : WEB_ENVIRONMENT_CLASSES) {
    if (!ClassUtils.isPresent(className, null)) {
      return WebApplicationType.NONE;
    }
  }
  return WebApplicationType.SERVLET;
}