Avoid codec auto-configuration when WebFlux is not present

This commit prevents the `CodecsAutoConfiguration` from being processed
if spring-webflux is not on classpath, since it is only useful for the
WebFlux server infrastructure or `WebClient`.

Closes gh-15690
pull/16971/head
Brian Clozel 6 years ago
parent 15bdc12335
commit b2e395db7a

@ -33,6 +33,7 @@ import org.springframework.http.codec.CodecConfigurer;
import org.springframework.http.codec.json.Jackson2JsonDecoder;
import org.springframework.http.codec.json.Jackson2JsonEncoder;
import org.springframework.util.MimeType;
import org.springframework.web.reactive.function.client.WebClient;
/**
* {@link EnableAutoConfiguration Auto-configuration} for
@ -43,7 +44,7 @@ import org.springframework.util.MimeType;
* @since 2.0.0
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(CodecConfigurer.class)
@ConditionalOnClass({ CodecConfigurer.class, WebClient.class })
@AutoConfigureAfter(JacksonAutoConfiguration.class)
public class CodecsAutoConfiguration {

Loading…
Cancel
Save