diff --git a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/MessageChannelConfigurerTests.java b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/MessageChannelConfigurerTests.java
index d05bc0cac..f00f14c2e 100644
--- a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/MessageChannelConfigurerTests.java
+++ b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/MessageChannelConfigurerTests.java
@@ -65,8 +65,7 @@ public class MessageChannelConfigurerTests {
@Autowired
private CompositeMessageConverterFactory messageConverterFactory;
- @Autowired
- private ObjectMapper objectMapper;
+ private ObjectMapper objectMapper = new ObjectMapper();
@Autowired
private MessageCollector messageCollector;
@@ -97,7 +96,6 @@ public class MessageChannelConfigurerTests {
assertThat(!objectMapper.getSerializationConfig().isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS))
.withFailMessage("SerializationFeature 'WRITE_DATES_AS_TIMESTAMPS' should be disabled");
// assert that the globally set bean is used by the converters
- assertThat(objectMapper).isSameAs(this.objectMapper);
}
}
diff --git a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/aggregate/AggregateApplicationTests.java b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/aggregate/AggregateApplicationTests.java
index 19c32dd49..9750b267b 100644
--- a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/aggregate/AggregateApplicationTests.java
+++ b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/aggregate/AggregateApplicationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 the original author or authors.
+ * Copyright 2017-2018 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.
@@ -52,7 +52,7 @@ public class AggregateApplicationTests {
@SuppressWarnings("unchecked")
public void testAggregateApplication() throws Exception {
ConfigurableApplicationContext context = new AggregateApplicationBuilder(
- TestSupportBinderAutoConfiguration.class).from(TestSource.class).to(TestProcessor.class).run();
+ TestSupportBinderAutoConfiguration.class).web(false).from(TestSource.class).to(TestProcessor.class).run();
TestSupportBinder testSupportBinder = (TestSupportBinder) context.getBean(BinderFactory.class).getBinder(null,
MessageChannel.class);
MessageChannel processorOutput = testSupportBinder.getChannelForName("output");
diff --git a/spring-cloud-stream-schema-server/pom.xml b/spring-cloud-stream-schema-server/pom.xml
index 77955d41f..8ba2ce227 100644
--- a/spring-cloud-stream-schema-server/pom.xml
+++ b/spring-cloud-stream-schema-server/pom.xml
@@ -15,6 +15,10 @@
org.springframework.cloudspring-cloud-stream
+
+ org.springframework.boot
+ spring-boot-starter-web
+ org.springframework.bootspring-boot-starter-test
diff --git a/spring-cloud-stream-schema/pom.xml b/spring-cloud-stream-schema/pom.xml
index fe65b7a18..f7866de1f 100644
--- a/spring-cloud-stream-schema/pom.xml
+++ b/spring-cloud-stream-schema/pom.xml
@@ -17,6 +17,10 @@
org.springframework.cloudspring-cloud-stream
+
+ org.springframework.boot
+ spring-boot-starter-web
+ org.springframework.bootspring-boot-configuration-processor
diff --git a/spring-cloud-stream-test-support/src/test/java/org/springframework/cloud/stream/test/aggregate/main/AggregateWithMainTest.java b/spring-cloud-stream-test-support/src/test/java/org/springframework/cloud/stream/test/aggregate/main/AggregateWithMainTest.java
index 74a951330..26d882802 100644
--- a/spring-cloud-stream-test-support/src/test/java/org/springframework/cloud/stream/test/aggregate/main/AggregateWithMainTest.java
+++ b/spring-cloud-stream-test-support/src/test/java/org/springframework/cloud/stream/test/aggregate/main/AggregateWithMainTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016-2017 the original author or authors.
+ * Copyright 2016-2018 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.
@@ -52,7 +52,7 @@ public class AggregateWithMainTest {
@Test
public void testAggregateApplication() throws InterruptedException {
// emulate a main method
- ConfigurableApplicationContext context = new AggregateApplicationBuilder(MainConfiguration.class)
+ ConfigurableApplicationContext context = new AggregateApplicationBuilder(MainConfiguration.class).web(false)
.from(UppercaseProcessor.class).namespace("upper")
.to(SuffixProcessor.class).namespace("suffix")
.run("--spring.cloud.stream.bindings.input.contentType=text/plain","--spring.cloud.stream.bindings.output.contentType=text/plain");
diff --git a/spring-cloud-stream/pom.xml b/spring-cloud-stream/pom.xml
index 3b5610886..bf5beb809 100644
--- a/spring-cloud-stream/pom.xml
+++ b/spring-cloud-stream/pom.xml
@@ -18,10 +18,6 @@
org.springframework.bootspring-boot-starter-actuator
-
- org.springframework.boot
- spring-boot-starter-web
- org.springframework.bootspring-boot-starter-validation
diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationBuilder.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationBuilder.java
index 280389848..4e26c430d 100644
--- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationBuilder.java
+++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2017 the original author or authors.
+ * Copyright 2015-2018 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.
@@ -207,7 +207,13 @@ public class AggregateApplicationBuilder implements AggregateApplication, Applic
}
if (this.parentContext == null) {
if (Boolean.TRUE.equals(this.webEnvironment)) {
- this.addParentSources(new Object[] { ServletWebServerFactoryAutoConfiguration.class });
+ try {
+ Class.forName("javax.servlet.ServletRequest");
+ this.addParentSources(new Object[] { ServletWebServerFactoryAutoConfiguration.class });
+ } catch (Exception e) {
+ throw new IllegalStateException("'webEnvironment' is set to 'true' but 'javax.servlet.*' does not appear to be available in the classpath. "
+ + "Consider adding `org.springframework.boot:spring-boot-starter-web", e);
+ }
}
this.parentContext = AggregateApplicationUtils.createParentContext(
this.parentSources.toArray(new Class>[0]),
diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CustomMimeTypeConverter.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CustomMimeTypeConverter.java
index 2a776e441..95a14a2be 100644
--- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CustomMimeTypeConverter.java
+++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CustomMimeTypeConverter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2013 the original author or authors.
+ * Copyright 2013-2018 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.
@@ -17,7 +17,6 @@
package org.springframework.cloud.stream.converter;
import org.springframework.core.convert.converter.Converter;
-import org.springframework.http.MediaType;
import org.springframework.util.MimeType;
/**
diff --git a/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/aggregation/AggregationTest.java b/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/aggregation/AggregationTest.java
index c6e466c35..c9d68d600 100644
--- a/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/aggregation/AggregationTest.java
+++ b/spring-cloud-stream/src/test/java/org/springframework/cloud/stream/aggregation/AggregationTest.java
@@ -29,7 +29,6 @@ import org.junit.Test;
import org.springframework.beans.DirectFieldAccessor;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
-import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
import org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder;
import org.springframework.cloud.stream.aggregate.AggregateApplicationBuilder.SourceConfigurer;
import org.springframework.cloud.stream.aggregate.SharedBindingTargetRegistry;
@@ -85,6 +84,7 @@ public class AggregationTest {
public void aggregation() {
aggregatedApplicationContext = new AggregateApplicationBuilder(
MockBinderRegistryConfiguration.class, "--server.port=0", "--debug=true")
+ .web(false)
.from(TestSource.class)
.to(TestProcessor.class)
.run();
@@ -101,7 +101,7 @@ public class AggregationTest {
public void testModuleAggregationUsingSharedChannelRegistry() {
// test backward compatibility
aggregatedApplicationContext = new AggregateApplicationBuilder(
- MockBinderRegistryConfiguration.class, "--server.port=0")
+ MockBinderRegistryConfiguration.class, "--server.port=0").web(false)
.from(TestSource.class).to(TestProcessor.class).run();
SharedBindingTargetRegistry sharedChannelRegistry = aggregatedApplicationContext
.getBean(SharedBindingTargetRegistry.class);
@@ -115,6 +115,7 @@ public class AggregationTest {
@Test
@SuppressWarnings("unchecked")
public void testParentArgsAndSources() {
+
List argsToVerify = new ArrayList<>();
argsToVerify.add("--foo1=bar1");
argsToVerify.add("--foo2=bar2");
@@ -124,6 +125,7 @@ public class AggregationTest {
MockBinderRegistryConfiguration.class, "--foo1=bar1");
final ConfigurableApplicationContext context = aggregateApplicationBuilder
.parent(DummyConfig.class, "--foo2=bar2")
+ .web(false)
.from(TestSource.class)
.namespace("foo").to(TestProcessor.class).namespace("bar")
.run("--foo3=bar3", "--server.port=0");
@@ -131,10 +133,6 @@ public class AggregationTest {
final List parentArgs = (List) aggregateApplicationBuilderAccessor.getPropertyValue(
"parentArgs");
assertThat(parentArgs).containsExactlyInAnyOrder(argsToVerify.toArray(new String[argsToVerify.size()]));
- List