Address camelCase properties binding issue

Because of a re-bind of properties that is needed to address the way
default properties are handled (See the prvious commit), camelCase
binding is broken. Fixing this issue with camelCase binding.

Resolves #1495
This commit is contained in:
Soby Chacko
2018-10-08 17:45:44 -04:00
parent 3b1f846179
commit 0249867e63
2 changed files with 18 additions and 2 deletions

View File

@@ -113,7 +113,8 @@ public class EnvironmentEntryInitializingTreeMap<T> extends AbstractMap<String,
}
};
binder.bind("spring.cloud.stream.bindings." + key, Bindable.ofInstance(defaultProperties), handler);
String configElements = "spring.cloud.stream.bindings." + key;
binder.bind(configElements.toLowerCase(), Bindable.ofInstance(defaultProperties), handler);
((MergableProperties)defaultProperties).merge((MergableProperties) value, setProperties.toArray(new String[0]));
return this.delegate.put(key, value);

View File

@@ -446,7 +446,9 @@ public class BindingServiceTests {
"--spring.cloud.stream.bindings.input2.consumer.concurrency=1",
"--spring.cloud.stream.bindings.input1.consumer.partitioned=true",
"--spring.cloud.stream.default.producer.partitionCount=10",
"--spring.cloud.stream.bindings.output2.producer.partitionCount=1");
"--spring.cloud.stream.bindings.output2.producer.partitionCount=1",
"--spring.cloud.stream.bindings.inputXyz.contentType=application/json",
"--spring.cloud.stream.bindings.inputFooBar.contentType=application/avro");
BindingServiceProperties bindingServiceProperties = run.getBeanFactory().getBean(BindingServiceProperties.class);
Map<String, BindingProperties> bindings = bindingServiceProperties.getBindings();
@@ -461,6 +463,10 @@ public class BindingServiceTests {
assertThat(bindings.get("input2").getConsumer().isPartitioned()).isEqualTo(false);
assertThat(bindings.get("output1").getProducer().getPartitionCount()).isEqualTo(10);
assertThat(bindings.get("output2").getProducer().getPartitionCount()).isEqualTo(1);
assertThat(bindings.get("inputXyz").getContentType()).isEqualTo("application/json");
assertThat(bindings.get("inputFooBar").getContentType()).isEqualTo("application/avro");
assertThat(bindings.get("inputFooBarBuzz").getContentType()).isEqualTo("text/plain");
}
@EnableBinding(FooBinding.class)
@@ -485,6 +491,15 @@ public class BindingServiceTests {
@Output("output2")
MessageChannel out2();
@Input("inputXyz")
SubscribableChannel inXyz();
@Input("inputFooBar")
SubscribableChannel inFooBar();
@Input("inputFooBarBuzz")
SubscribableChannel inFooBarBuzz();
}
@Test