diff --git a/pom.xml b/pom.xml index 4d0734900..98541e4f7 100644 --- a/pom.xml +++ b/pom.xml @@ -57,22 +57,6 @@ org.springframework.boot spring-boot-starter-webflux - - - io.projectreactor.ipc - reactor-netty - 0.6.1.BUILD-SNAPSHOT - - - org.springframework.boot.experimental - spring-boot-starter-web-reactive - - - org.springframework.boot - spring-boot-starter-tomcat - - - org.springframework.boot spring-boot-configuration-processor @@ -98,7 +82,7 @@ spring-cloud-starter-hystrix true - + io.reactivex rxjava-reactive-streams @@ -147,9 +131,9 @@ - org.springframework.boot.experimental - spring-boot-dependencies-web-reactive - 0.1.0.BUILD-SNAPSHOT + org.springframework.boot + spring-boot-dependencies + 2.0.0.BUILD-SNAPSHOT pom import diff --git a/src/main/java/org/springframework/cloud/gateway/config/GatewayEnvironmentPostProcessor.java b/src/main/java/org/springframework/cloud/gateway/config/GatewayEnvironmentPostProcessor.java deleted file mode 100644 index 49ea87cd5..000000000 --- a/src/main/java/org/springframework/cloud/gateway/config/GatewayEnvironmentPostProcessor.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.springframework.cloud.gateway.config; - -import java.util.Collections; -import java.util.Map; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.env.EnvironmentPostProcessor; -import org.springframework.core.Ordered; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.MapPropertySource; - -/** - * @author Spencer Gibb - */ -public class GatewayEnvironmentPostProcessor implements EnvironmentPostProcessor, Ordered { - - public static final int DEFAULT_ORDER = Ordered.HIGHEST_PRECEDENCE + 10; - - @Override - public int getOrder() { - return DEFAULT_ORDER; - } - - @Override - public void postProcessEnvironment(ConfigurableEnvironment configurableEnvironment, SpringApplication springApplication) { - //TODO: make this configurable? - //TODO: should I have to do this? - final Map properties = Collections.singletonMap("spring.resources.add-mappings", "false"); - configurableEnvironment.getPropertySources().addLast(new MapPropertySource("gateway", properties)); - } -} - diff --git a/src/main/java/org/springframework/cloud/gateway/config/PostBootstrapApplicationListener.java b/src/main/java/org/springframework/cloud/gateway/config/PostBootstrapApplicationListener.java deleted file mode 100644 index 3c7680b05..000000000 --- a/src/main/java/org/springframework/cloud/gateway/config/PostBootstrapApplicationListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.springframework.cloud.gateway.config; - -import java.util.Collections; -import java.util.Map; - -import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.core.Ordered; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.MapPropertySource; - -import static org.springframework.cloud.bootstrap.BootstrapApplicationListener.BOOTSTRAP_PROPERTY_SOURCE_NAME; -import static org.springframework.cloud.bootstrap.BootstrapApplicationListener.DEFAULT_ORDER; - -/** - * Reenables reactive http server after bootstrap. - * TODO: remove when boot 2.0 handles the NONE web case - * @author Spencer Gibb - */ -public class PostBootstrapApplicationListener - implements ApplicationListener, Ordered { - @Override - public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { - ConfigurableEnvironment environment = event.getEnvironment(); - // don't listen to events in a bootstrap context - if (environment.getPropertySources().contains(BOOTSTRAP_PROPERTY_SOURCE_NAME)) { - return; - } - final Map map = Collections.singletonMap("spring.reactive.enabled", "true"); - environment.getPropertySources().addBefore("bootstrap-web-disabled", - new MapPropertySource("bootstrap-web-reenable", map)); - } - - @Override - public int getOrder() { - return DEFAULT_ORDER+1; - } -} diff --git a/src/main/java/org/springframework/cloud/gateway/config/PreBootstrapApplicationListener.java b/src/main/java/org/springframework/cloud/gateway/config/PreBootstrapApplicationListener.java deleted file mode 100644 index a0b8e0b6b..000000000 --- a/src/main/java/org/springframework/cloud/gateway/config/PreBootstrapApplicationListener.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2013-2017 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - -package org.springframework.cloud.gateway.config; - -import java.util.Collections; -import java.util.Map; - -import org.springframework.boot.context.event.ApplicationEnvironmentPreparedEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.core.Ordered; -import org.springframework.core.env.ConfigurableEnvironment; -import org.springframework.core.env.MapPropertySource; - -import static org.springframework.cloud.bootstrap.BootstrapApplicationListener.BOOTSTRAP_PROPERTY_SOURCE_NAME; -import static org.springframework.cloud.bootstrap.BootstrapApplicationListener.DEFAULT_ORDER; - -/** - * Disables reactive http server just before bootstrap. - * TODO: remove when boot 2.0 handles the NONE web case - * @author Spencer Gibb - */ -public class PreBootstrapApplicationListener - implements ApplicationListener, Ordered { - @Override - public void onApplicationEvent(ApplicationEnvironmentPreparedEvent event) { - ConfigurableEnvironment environment = event.getEnvironment(); - // don't listen to events in a bootstrap context - if (environment.getPropertySources().contains(BOOTSTRAP_PROPERTY_SOURCE_NAME)) { - return; - } - final Map map = Collections.singletonMap("spring.reactive.enabled", "false"); - environment.getPropertySources().addLast(new MapPropertySource("bootstrap-web-disabled", map)); - } - - @Override - public int getOrder() { - return DEFAULT_ORDER-1; - } -} diff --git a/src/main/resources/META-INF/spring.factories b/src/main/resources/META-INF/spring.factories index 2b7131564..8de7fa669 100644 --- a/src/main/resources/META-INF/spring.factories +++ b/src/main/resources/META-INF/spring.factories @@ -1,12 +1,3 @@ # Auto Configure org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ org.springframework.cloud.gateway.config.GatewayAutoConfiguration - -# Environment Post Processors -org.springframework.boot.env.EnvironmentPostProcessor=\ -org.springframework.cloud.gateway.config.GatewayEnvironmentPostProcessor - -# Application Listeners -org.springframework.context.ApplicationListener=\ -org.springframework.cloud.gateway.config.PreBootstrapApplicationListener,\ -org.springframework.cloud.gateway.config.PostBootstrapApplicationListener