From 4f72a10bc6c742048914851f59763ce0b78c08e6 Mon Sep 17 00:00:00 2001
From: Janne Valkealahti
Date: Fri, 12 May 2017 10:43:01 +0100
Subject: [PATCH] Upgrade build to boot 2.x
- Pump up version to 2.0.0
- Some generic polish
- All changes around breakage with boot 2.x
- Some boot classes has been moved around
- You can't no longer have binding key ending with
camelCase.
- New Binder now has illegal keys.
- Some changes to tests as we can directly do end-to-end
testing with ENV_VAR_FORMAT as normal keys
- Spring data repo changes as now uses Optional
- Remove relaxed binder and its tests in favor of new Binder
- Some mockito api changes
- One Ingored test TextPlainToJsonConversionTest.testTextPlainToJsonConversionOnInput
- Relates to #935
Cache metric export properties
Add code formatting guidelines
Rearranged files
---
pom.xml | 6 +-
spring-cloud-stream-binder-test/pom.xml | 2 +-
spring-cloud-stream-codec/pom.xml | 2 +-
spring-cloud-stream-core-docs/pom.xml | 2 +-
spring-cloud-stream-integration-tests/pom.xml | 2 +-
.../config/CustomMessageConverterTests.java | 9 +-
.../config/TextPlainToJsonConversionTest.java | 10 +-
spring-cloud-stream-metrics/pom.xml | 2 +-
.../metrics/ApplicationMetricsProperties.java | 125 ++++++++-------
.../metrics/RelaxedPropertiesUtils.java | 145 ------------------
.../ApplicationMetricsExporterTests.java | 5 +-
.../metrics/RelaxedPropertiesUtilsTests.java | 59 -------
spring-cloud-stream-reactive/pom.xml | 4 +
spring-cloud-stream-rxjava/pom.xml | 2 +-
spring-cloud-stream-schema-server/pom.xml | 4 +
.../server/controllers/ServerController.java | 14 +-
spring-cloud-stream-schema/pom.xml | 4 +
.../SchemaRegistryClientProperties.java | 2 +-
.../pom.xml | 2 +-
spring-cloud-stream-test-support/pom.xml | 2 +-
.../test/matcher/MessageQueueMatcher.java | 5 +-
spring-cloud-stream-tools/pom.xml | 8 +-
spring-cloud-stream/pom.xml | 2 +-
.../aggregate/AggregateApplication.java | 2 +-
.../AggregateApplicationBuilder.java | 84 +++++-----
.../aggregate/AggregateApplicationUtils.java | 7 +-
.../cloud/stream/binding/BindingService.java | 6 +-
.../EnvironmentEntryInitializingTreeMap.java | 13 +-
.../stream/aggregation/AggregationTest.java | 33 ++--
...traryInterfaceWithBindingTargetsTests.java | 12 +-
.../ArbitraryInterfaceWithDefaultsTests.java | 12 +-
.../BinderFactoryConfigurationTests.java | 4 +-
.../binder/InputOutputBindingOrderTest.java | 10 +-
...ocessorBindingWithBindingTargetsTests.java | 10 +-
.../ProcessorBindingsWithDefaultsTests.java | 10 +-
.../SinkBindingWithDefaultTargetsTests.java | 11 +-
.../binder/SinkBindingWithDefaultsTests.java | 10 +-
.../stream/binding/BindingServiceTests.java | 5 +-
.../partitioning/PartitionedConsumerTest.java | 15 +-
39 files changed, 244 insertions(+), 418 deletions(-)
delete mode 100644 spring-cloud-stream-metrics/src/main/java/org/springframework/cloud/stream/metrics/RelaxedPropertiesUtils.java
delete mode 100644 spring-cloud-stream-metrics/src/test/java/org/springframework/cloud/stream/metrics/RelaxedPropertiesUtilsTests.java
diff --git a/pom.xml b/pom.xml
index f7e25a92b..bc2a5bbfe 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,12 +3,12 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
spring-cloud-stream-parent
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
pom
org.springframework.cloud
spring-cloud-build
- 1.3.5.RELEASE
+ 2.0.0.BUILD-SNAPSHOT
@@ -18,7 +18,7 @@
HEAD
- 1.7
+ 1.8
1.1.10
1.2.1
1.0.0.RELEASE
diff --git a/spring-cloud-stream-binder-test/pom.xml b/spring-cloud-stream-binder-test/pom.xml
index 0f485d0d5..d3ebb490b 100644
--- a/spring-cloud-stream-binder-test/pom.xml
+++ b/spring-cloud-stream-binder-test/pom.xml
@@ -11,7 +11,7 @@
org.springframework.cloud
spring-cloud-stream-parent
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
diff --git a/spring-cloud-stream-codec/pom.xml b/spring-cloud-stream-codec/pom.xml
index 5c91cfa18..54bd4ad24 100644
--- a/spring-cloud-stream-codec/pom.xml
+++ b/spring-cloud-stream-codec/pom.xml
@@ -10,7 +10,7 @@
org.springframework.cloud
spring-cloud-stream-parent
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
diff --git a/spring-cloud-stream-core-docs/pom.xml b/spring-cloud-stream-core-docs/pom.xml
index 06b28155b..fbff70c4e 100644
--- a/spring-cloud-stream-core-docs/pom.xml
+++ b/spring-cloud-stream-core-docs/pom.xml
@@ -4,7 +4,7 @@
org.springframework.cloud
spring-cloud-stream-parent
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
spring-cloud-stream-core-docs
spring-cloud-stream-core-docs
diff --git a/spring-cloud-stream-integration-tests/pom.xml b/spring-cloud-stream-integration-tests/pom.xml
index 2cf520b6d..c26fb7f4c 100644
--- a/spring-cloud-stream-integration-tests/pom.xml
+++ b/spring-cloud-stream-integration-tests/pom.xml
@@ -10,7 +10,7 @@
org.springframework.cloud
spring-cloud-stream-parent
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
diff --git a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/CustomMessageConverterTests.java b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/CustomMessageConverterTests.java
index 5bc8658fb..2a589fcae 100644
--- a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/CustomMessageConverterTests.java
+++ b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/CustomMessageConverterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-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.
@@ -35,6 +35,7 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.integration.support.MessageBuilder;
+import org.springframework.integration.support.converter.ConfigurableCompositeMessageConverter;
import org.springframework.integration.support.converter.DefaultDatatypeChannelMessageConverter;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
@@ -49,6 +50,7 @@ import static org.hamcrest.Matchers.notNullValue;
/**
* @author Ilayaperumal Gopinathan
+ * @author Janne Valkealahti
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = CustomMessageConverterTests.TestSource.class)
@@ -66,9 +68,10 @@ public class CustomMessageConverterTests {
@Test
public void testCustomMessageConverter() throws Exception {
- assertThat(customMessageConverters).hasSize(3);
+ assertThat(customMessageConverters).hasSize(4);
assertThat(customMessageConverters).extracting("class").contains(FooConverter.class,
- BarConverter.class, DefaultDatatypeChannelMessageConverter.class);
+ BarConverter.class, DefaultDatatypeChannelMessageConverter.class,
+ ConfigurableCompositeMessageConverter.class);
testSource.output().send(MessageBuilder.withPayload(new Foo("hi")).build());
@SuppressWarnings("unchecked")
Message received = (Message) ((TestSupportBinder) binderFactory.getBinder(null,
diff --git a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/TextPlainToJsonConversionTest.java b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/TextPlainToJsonConversionTest.java
index c7bfca0fd..c24467f53 100644
--- a/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/TextPlainToJsonConversionTest.java
+++ b/spring-cloud-stream-integration-tests/src/test/java/org/springframework/cloud/stream/config/TextPlainToJsonConversionTest.java
@@ -55,7 +55,6 @@ public class TextPlainToJsonConversionTest {
@Test
public void testNoContentTypeToJsonConversionOnInput() throws Exception {
testProcessor.input().send(MessageBuilder.withPayload("{\"name\":\"Bar\"}").build());
- @SuppressWarnings("unchecked")
Message> received = ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
.messageCollector().forChannel(testProcessor.output()).poll(1, TimeUnit.SECONDS);
assertThat(received).isNotNull();
@@ -66,7 +65,6 @@ public class TextPlainToJsonConversionTest {
public void testTextPlainToJsonConversionOnInput() throws Exception {
testProcessor.input().send(MessageBuilder.withPayload("{\"name\":\"Bar\"}")
.setHeader(MessageHeaders.CONTENT_TYPE, "text/plain").build());
- @SuppressWarnings("unchecked")
Message> received = ((TestSupportBinder) binderFactory.getBinder(null, MessageChannel.class))
.messageCollector().forChannel(testProcessor.output()).poll(1, TimeUnit.SECONDS);
assertThat(received).isNotNull();
@@ -80,7 +78,9 @@ public class TextPlainToJsonConversionTest {
@StreamListener("input")
@SendTo("output")
public Foo consume(Foo foo) {
- return new Foo("transformed-" + foo.getName());
+ Foo returnFoo = new Foo();
+ returnFoo.setName("transformed-" + foo.getName());
+ return returnFoo;
}
}
@@ -92,10 +92,6 @@ public class TextPlainToJsonConversionTest {
public Foo() {
}
- public Foo(String name) {
- this.name = name;
- }
-
public String getName() {
return name;
}
diff --git a/spring-cloud-stream-metrics/pom.xml b/spring-cloud-stream-metrics/pom.xml
index 279d9a73d..286aed542 100644
--- a/spring-cloud-stream-metrics/pom.xml
+++ b/spring-cloud-stream-metrics/pom.xml
@@ -11,7 +11,7 @@
org.springframework.cloud
spring-cloud-stream-parent
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
diff --git a/spring-cloud-stream-metrics/src/main/java/org/springframework/cloud/stream/metrics/ApplicationMetricsProperties.java b/spring-cloud-stream-metrics/src/main/java/org/springframework/cloud/stream/metrics/ApplicationMetricsProperties.java
index 875f0bcc4..4b1c4c47e 100644
--- a/spring-cloud-stream-metrics/src/main/java/org/springframework/cloud/stream/metrics/ApplicationMetricsProperties.java
+++ b/spring-cloud-stream-metrics/src/main/java/org/springframework/cloud/stream/metrics/ApplicationMetricsProperties.java
@@ -18,31 +18,38 @@ package org.springframework.cloud.stream.metrics;
import java.util.HashMap;
import java.util.Map;
+import java.util.Map.Entry;
+import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.BeanExpressionContext;
import org.springframework.beans.factory.config.BeanExpressionResolver;
import org.springframework.boot.actuate.metrics.export.MetricExportProperties;
import org.springframework.boot.actuate.metrics.export.TriggerProperties;
-import org.springframework.boot.bind.RelaxedNames;
import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.boot.context.properties.bind.BindResult;
+import org.springframework.boot.context.properties.bind.Bindable;
+import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.cloud.stream.metrics.config.BinderMetricsAutoConfiguration;
-import org.springframework.context.ApplicationListener;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
-import org.springframework.context.event.ContextRefreshedEvent;
-import org.springframework.core.env.ConfigurableEnvironment;
-import org.springframework.core.env.EnumerablePropertySource;
-import org.springframework.core.env.PropertySource;
+import org.springframework.context.EnvironmentAware;
+import org.springframework.core.env.Environment;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;
import org.springframework.util.PatternMatchUtils;
/**
* @author Vinicius Carvalho
+ * @author Janne Valkealahti
*/
@ConfigurationProperties(prefix = "spring.cloud.stream.metrics")
public class ApplicationMetricsProperties
- implements ApplicationListener {
+ implements EnvironmentAware, ApplicationContextAware {
+
+ private static final Bindable
*
* @author Eric Bottard
+ * @author Janne Valkealahti
*/
public class MessageQueueMatcher extends BaseMatcher>> {
diff --git a/spring-cloud-stream-tools/pom.xml b/spring-cloud-stream-tools/pom.xml
index 1a7c18399..2945beecd 100644
--- a/spring-cloud-stream-tools/pom.xml
+++ b/spring-cloud-stream-tools/pom.xml
@@ -4,15 +4,19 @@
org.springframework.cloud
spring-cloud-build
- 1.3.5.RELEASE
+ 2.0.0.BUILD-SNAPSHOT
spring-cloud-stream-tools
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
spring-cloud-stream-build-tools
Spring Cloud Stream Build Tools
+
+ 1.8
+
+
spring
diff --git a/spring-cloud-stream/pom.xml b/spring-cloud-stream/pom.xml
index 001497d68..3b5610886 100644
--- a/spring-cloud-stream/pom.xml
+++ b/spring-cloud-stream/pom.xml
@@ -10,7 +10,7 @@
org.springframework.cloud
spring-cloud-stream-parent
- 1.3.1.BUILD-SNAPSHOT
+ 2.0.0.BUILD-SNAPSHOT
diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplication.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplication.java
index 16efe4926..127804445 100644
--- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplication.java
+++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplication.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2016 the original author or authors.
+ * Copyright 2016-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.
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 bce346eec..70e7c05a2 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
@@ -18,7 +18,6 @@ package org.springframework.cloud.stream.aggregate;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
@@ -34,11 +33,11 @@ import org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics;
import org.springframework.boot.actuate.endpoint.MetricsEndpoint;
import org.springframework.boot.autoconfigure.ImportAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
-import org.springframework.boot.bind.PropertySourcesPropertyValues;
-import org.springframework.boot.bind.RelaxedDataBinder;
-import org.springframework.boot.bind.RelaxedNames;
+import org.springframework.boot.autoconfigure.web.servlet.ServletWebServerFactoryAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.context.properties.bind.BindResult;
+import org.springframework.boot.context.properties.bind.Bindable;
+import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.binding.BindableProxyFactory;
import org.springframework.cloud.stream.config.ChannelBindingAutoConfiguration;
@@ -46,7 +45,7 @@ import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
-import org.springframework.core.env.PropertySources;
+import org.springframework.core.env.Environment;
import org.springframework.integration.monitor.IntegrationMBeanExporter;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
@@ -58,6 +57,7 @@ import org.springframework.util.StringUtils;
* @author Ilayaperumal Gopinathan
* @author Marius Bogoevici
* @author Venil Noronha
+ * @author Janne Valkealahti
*/
@EnableBinding
public class AggregateApplicationBuilder implements AggregateApplication, ApplicationContextAware,
@@ -65,6 +65,9 @@ public class AggregateApplicationBuilder implements AggregateApplication, Applic
private static final String CHILD_CONTEXT_SUFFIX = ".spring.cloud.stream.context";
+ private static final Bindable> STRING_STRING_MAP = Bindable
+ .mapOf(String.class, String.class);
+
private SourceConfigurer sourceConfigurer;
private SinkConfigurer sinkConfigurer;
@@ -194,18 +197,21 @@ public class AggregateApplicationBuilder implements AggregateApplication, Applic
Class> appToEmbed = appConfigurer.getApp();
// Always update namespace before preparing SharedChannelRegistry
if (appConfigurer.namespace == null) {
+ // to remove illegal characters for new properties
+ // binder
+ // org.springframework.cloud.stream.aggregation.AggregationTest$TestSource
appConfigurer.namespace = AggregateApplicationUtils
- .getDefaultNamespace(appConfigurer.getApp().getName(), i);
+ .getDefaultNamespace(appConfigurer.getApp().getName().replaceAll("\\$", "."), i);
}
appsToEmbed.put(appToEmbed, appConfigurer.namespace);
appConfigurers.put(appConfigurer, appConfigurer.namespace);
}
if (this.parentContext == null) {
if (Boolean.TRUE.equals(this.webEnvironment)) {
- this.addParentSources(new Object[] { EmbeddedServletContainerAutoConfiguration.class });
+ this.addParentSources(new Object[] { ServletWebServerFactoryAutoConfiguration.class });
}
this.parentContext = AggregateApplicationUtils.createParentContext(
- this.parentSources.toArray(new Object[0]),
+ this.parentSources.toArray(new Class>[0]),
this.parentArgs.toArray(new String[0]), selfContained(), this.webEnvironment, this.headless);
}
else {
@@ -221,45 +227,25 @@ public class AggregateApplicationBuilder implements AggregateApplication, Applic
SharedBindingTargetRegistry sharedBindingTargetRegistry = this.parentContext
.getBean(SharedBindingTargetRegistry.class);
AggregateApplicationUtils.prepareSharedBindingTargetRegistry(sharedBindingTargetRegistry, appsToEmbed);
- PropertySources propertySources = this.parentContext.getEnvironment()
- .getPropertySources();
for (Map.Entry appConfigurerEntry : appConfigurers.entrySet()) {
AppConfigurer appConfigurer = appConfigurerEntry.getKey();
+ if (appConfigurerEntry.getValue() == null) {
+ continue;
+ }
String namespace = appConfigurerEntry.getValue().toLowerCase();
Set argsToUpdate = new LinkedHashSet<>();
Set argKeys = new LinkedHashSet<>();
- final HashMap target = new HashMap<>();
- RelaxedDataBinder relaxedDataBinder = new RelaxedDataBinder(target, namespace);
- relaxedDataBinder.bind(new PropertySourcesPropertyValues(propertySources));
+ Map target = bindProperties(namespace, this.parentContext.getEnvironment());
+
if (!target.isEmpty()) {
for (Map.Entry entry : target.entrySet()) {
- // only update the values with the highest precedence level.
- if (!relaxedNameKeyExists(entry.getKey(), argKeys)) {
- String key = entry.getKey();
- // in case of environment variables pass the lower-case property
- // key
- // as we pass the properties as command line properties
- if (key.contains("_")) {
- key = key.replace("_", "-").toLowerCase();
- }
- argKeys.add(key);
- argsToUpdate.add("--" + key + "=" + entry.getValue());
- }
- }
- }
- // Add the args that are set at the application level if they weren't
- // overridden above from other property sources.
- if (appConfigurer.getArgs() != null) {
- for (String arg : appConfigurer.getArgs()) {
- // use the key part left to the assignment and trimming the prefix
- // `--`
- String key = arg.substring(0, arg.indexOf("=")).substring(2);
- if (!relaxedNameKeyExists(key, argKeys)) {
- argsToUpdate.add(arg);
- }
+ String key = entry.getKey();
+ argKeys.add(key);
+ argsToUpdate.add("--" + key + "=" + entry.getValue());
}
}
+
if (!argsToUpdate.isEmpty()) {
appConfigurer.args(argsToUpdate.toArray(new String[0]));
}
@@ -279,21 +265,23 @@ public class AggregateApplicationBuilder implements AggregateApplication, Applic
return (this.sourceConfigurer != null) && (this.sinkConfigurer != null);
}
- private boolean relaxedNameKeyExists(String key, Collection collection) {
- RelaxedNames relaxedNames = new RelaxedNames(key);
- for (String name : relaxedNames) {
- if (collection.contains(name)) {
- return true;
- }
- }
- return false;
- }
-
private ChildContextBuilder childContext(Class> app, ConfigurableApplicationContext parentContext,
String namespace) {
return new ChildContextBuilder(AggregateApplicationUtils.embedApp(parentContext, namespace, app));
}
+ private Map bindProperties(String namepace, Environment environment) {
+ Map target;
+ BindResult> bindResult = Binder.get(environment).bind(namepace, STRING_STRING_MAP);
+ if (bindResult.isBound()) {
+ target = bindResult.get();
+ }
+ else {
+ target = new HashMap<>();
+ }
+ return target;
+ }
+
private static class ChildContextHolder {
private final ConfigurableApplicationContext childContext;
diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationUtils.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationUtils.java
index 1c58a2666..def43c7c2 100644
--- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationUtils.java
+++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/aggregate/AggregateApplicationUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-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.
@@ -32,6 +32,7 @@ import org.springframework.messaging.SubscribableChannel;
* @author Marius Bogoevici
* @author Ilayaperumal Gopinathan
* @author Venil Noronha
+ * @author Janne Valkealahti
*/
abstract class AggregateApplicationUtils {
@@ -39,7 +40,7 @@ abstract class AggregateApplicationUtils {
public static final String OUTPUT_BINDING_NAME = "output";
- static ConfigurableApplicationContext createParentContext(Object[] sources,
+ static ConfigurableApplicationContext createParentContext(Class>[] sources,
String[] args, final boolean selfContained, boolean webEnvironment,
boolean headless) {
SpringApplicationBuilder aggregatorParentConfiguration = new SpringApplicationBuilder();
@@ -53,7 +54,7 @@ abstract class AggregateApplicationUtils {
}
static String getDefaultNamespace(String appClassName, int index) {
- return appClassName + "_" + index;
+ return appClassName + "-" + index;
}
protected static SpringApplicationBuilder embedApp(
diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java
index 28329cbc2..bc2718a64 100644
--- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java
+++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindingService.java
@@ -27,7 +27,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeanUtils;
-import org.springframework.boot.bind.RelaxedDataBinder;
import org.springframework.cloud.stream.binder.Binder;
import org.springframework.cloud.stream.binder.BinderFactory;
import org.springframework.cloud.stream.binder.Binding;
@@ -39,6 +38,7 @@ import org.springframework.cloud.stream.binder.ProducerProperties;
import org.springframework.cloud.stream.config.BindingServiceProperties;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
+import org.springframework.validation.DataBinder;
import org.springframework.validation.beanvalidation.CustomValidatorBean;
/**
@@ -49,6 +49,7 @@ import org.springframework.validation.beanvalidation.CustomValidatorBean;
* @author Marius Bogoevici
* @author Ilayaperumal Gopinathan
* @author Gary Russell
+ * @author Janne Valkealahti
*/
public class BindingService {
@@ -149,7 +150,6 @@ public class BindingService {
}
}
- @SuppressWarnings("unchecked")
private Binder getBinder(String channelName, Class bindableType) {
String binderConfigurationName = this.bindingServiceProperties.getBinder(channelName);
return binderFactory.getBinder(binderConfigurationName, bindableType);
@@ -170,7 +170,7 @@ public class BindingService {
}
private void validate(Object properties) {
- RelaxedDataBinder dataBinder = new RelaxedDataBinder(properties);
+ DataBinder dataBinder = new DataBinder(properties);
dataBinder.setValidator(validator);
dataBinder.validate();
if (dataBinder.getBindingResult().hasErrors()) {
diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java
index 0b9ed276f..ecda170d3 100644
--- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java
+++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/EnvironmentEntryInitializingTreeMap.java
@@ -21,9 +21,9 @@ import java.util.Map;
import java.util.Set;
import org.springframework.beans.BeanUtils;
-import org.springframework.boot.bind.PropertySourcesPropertyValues;
-import org.springframework.boot.bind.RelaxedDataBinder;
import org.springframework.core.convert.ConversionService;
+import org.springframework.boot.context.properties.bind.Bindable;
+import org.springframework.boot.context.properties.bind.Binder;
import org.springframework.core.env.ConfigurableEnvironment;
import org.springframework.util.Assert;
@@ -40,6 +40,7 @@ import org.springframework.util.Assert;
*
* @author Marius Bogoevici
* @author Ilayaperumal Gopinathan
+ * @author Janne Valkealahti
*/
public class EnvironmentEntryInitializingTreeMap extends AbstractMap {
@@ -55,7 +56,7 @@ public class EnvironmentEntryInitializingTreeMap extends AbstractMap extends AbstractMap extends AbstractMap sources = (List