Enable Tomcat, Jetty and Undertow reactive auto-conf

Closes gh-8403
pull/8410/head
Brian Clozel 8 years ago
parent f1d4d8434b
commit 3a8be10be8

@ -47,7 +47,10 @@ import org.springframework.util.ObjectUtils;
@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.REACTIVE)
@EnableConfigurationProperties(ServerProperties.class)
@Import({ReactiveWebServerAutoConfiguration.BeanPostProcessorsRegistrar.class,
ReactiveWebServerConfiguration.ReactorNettyAutoConfiguration.class})
ReactiveWebServerConfiguration.TomcatAutoConfiguration.class,
ReactiveWebServerConfiguration.JettyAutoConfiguration.class,
ReactiveWebServerConfiguration.ReactorNettyAutoConfiguration.class,
ReactiveWebServerConfiguration.UndertowAutoConfiguration.class})
public class ReactiveWebServerAutoConfiguration {
@ConditionalOnMissingBean

@ -16,12 +16,16 @@
package org.springframework.boot.autoconfigure.webflux;
import io.undertow.Undertow;
import reactor.ipc.netty.http.server.HttpServer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.embedded.ReactiveWebServerFactory;
import org.springframework.boot.context.embedded.jetty.JettyReactiveWebServerFactory;
import org.springframework.boot.context.embedded.reactor.ReactorNettyReactiveWebServerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatReactiveWebServerFactory;
import org.springframework.boot.context.embedded.undertow.UndertowReactiveWebServerFactory;
import org.springframework.context.annotation.Bean;
/**
@ -42,4 +46,32 @@ abstract class ReactiveWebServerConfiguration {
}
}
@ConditionalOnMissingBean(ReactiveWebServerFactory.class)
@ConditionalOnClass({org.apache.catalina.startup.Tomcat.class})
static class TomcatAutoConfiguration {
@Bean
public TomcatReactiveWebServerFactory tomcatReactiveWebServerFactory() {
return new TomcatReactiveWebServerFactory();
}
}
@ConditionalOnMissingBean(ReactiveWebServerFactory.class)
@ConditionalOnClass({org.eclipse.jetty.server.Server.class})
static class JettyAutoConfiguration {
@Bean
public JettyReactiveWebServerFactory jettyReactiveWebServerFactory() {
return new JettyReactiveWebServerFactory();
}
}
@ConditionalOnMissingBean(ReactiveWebServerFactory.class)
@ConditionalOnClass({Undertow.class})
static class UndertowAutoConfiguration {
@Bean
public UndertowReactiveWebServerFactory undertowReactiveWebServerFactory() {
return new UndertowReactiveWebServerFactory();
}
}
}

Loading…
Cancel
Save