Use web-application-type=reactive by default if webflux present
We want the default application type to be REACTIVE if webflux is present (formerly it was NONE). In AWS and Azure we also want the webflux beans to be switched off in a "lite" application context (formerly they were unconditional).
This commit is contained in:
@@ -24,12 +24,14 @@ import java.util.function.Function;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.boot.WebApplicationType;
|
||||
import org.springframework.boot.autoconfigure.web.ErrorProperties;
|
||||
import org.springframework.boot.autoconfigure.web.ResourceProperties;
|
||||
import org.springframework.boot.autoconfigure.web.reactive.error.DefaultErrorWebExceptionHandler;
|
||||
import org.springframework.boot.web.reactive.error.DefaultErrorAttributes;
|
||||
import org.springframework.boot.web.reactive.error.ErrorAttributes;
|
||||
import org.springframework.cloud.function.context.FunctionCatalog;
|
||||
import org.springframework.cloud.function.context.FunctionalSpringApplication;
|
||||
import org.springframework.cloud.function.context.catalog.FunctionInspector;
|
||||
import org.springframework.cloud.function.json.JsonMapper;
|
||||
import org.springframework.cloud.function.web.BasicStringConverter;
|
||||
@@ -76,8 +78,12 @@ class FunctionEndpointInitializer
|
||||
|
||||
@Override
|
||||
public void initialize(GenericApplicationContext context) {
|
||||
if (context.getEnvironment().getProperty("spring.functional.enabled",
|
||||
Boolean.class, false)
|
||||
if (context.getEnvironment().getProperty(
|
||||
FunctionalSpringApplication.SPRING_WEB_APPLICATION_TYPE,
|
||||
WebApplicationType.class,
|
||||
WebApplicationType.REACTIVE) == WebApplicationType.REACTIVE
|
||||
&& context.getEnvironment().getProperty("spring.functional.enabled",
|
||||
Boolean.class, false)
|
||||
&& ClassUtils.isPresent(
|
||||
"org.springframework.http.server.reactive.HttpHandler", null)) {
|
||||
registerEndpoint(context);
|
||||
|
||||
@@ -35,7 +35,8 @@ import reactor.core.publisher.Mono;
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@FunctionalSpringBootTest
|
||||
//Only need web-application-type because MVC is on the classpath
|
||||
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
|
||||
@AutoConfigureWebTestClient
|
||||
public class FunctionalTests {
|
||||
|
||||
|
||||
@@ -37,7 +37,8 @@ import reactor.core.publisher.Mono;
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@FunctionalSpringBootTest
|
||||
// Only need web-application-type because MVC is on the classpath
|
||||
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
|
||||
@AutoConfigureWebTestClient
|
||||
public class HeadersToMessageTests {
|
||||
|
||||
|
||||
@@ -35,7 +35,8 @@ import reactor.core.publisher.Mono;
|
||||
*
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@FunctionalSpringBootTest
|
||||
//Only need web-application-type because MVC is on the classpath
|
||||
@FunctionalSpringBootTest("spring.main.web-application-type=reactive")
|
||||
@AutoConfigureWebTestClient
|
||||
public class PojoTests {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user