polishing
This commit is contained in:
@@ -730,7 +730,7 @@ If your application should connect to more than one broker of the same type, you
|
||||
Turning on explicit binder configuration will disable the default binder configuration process altogether.
|
||||
If you do this, all binders in use must be included in the configuration.
|
||||
Frameworks that intend to use Spring Cloud Stream transparently may create binder configurations that can be referenced by name, but will not affect the default binder configuration.
|
||||
In order to do so, a binder configuration may have its the `defaultCandidate` flag set to false, e.g. `spring.cloud.stream.binders.<configurationName>.defaultCandidate=false`.
|
||||
In order to do so, a binder configuration may have its `defaultCandidate` flag set to false, e.g. `spring.cloud.stream.binders.<configurationName>.defaultCandidate=false`.
|
||||
This denotes a configuration that will exist independently of the default binder configuration process.
|
||||
====
|
||||
|
||||
@@ -766,7 +766,7 @@ spring:
|
||||
=== Binder configuration properties
|
||||
|
||||
The following properties are available when creating custom binder configurations.
|
||||
They must be prefixed with `spring.cloud.stream.binder.<configurationName>`.
|
||||
They must be prefixed with `spring.cloud.stream.binders.<configurationName>`.
|
||||
|
||||
type::
|
||||
The binder type.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2015 the original author or authors.
|
||||
* Copyright 2015-2016 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.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.cloud.stream.binder;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* Configuration for a binder instance, associating a {@link BinderType} with its configuration {@link Properties}.
|
||||
* An application may contain multiple {@link BinderConfiguration}s per {@link BinderType}, when connecting to multiple
|
||||
* systems of the same type.
|
||||
@@ -39,9 +38,8 @@ public class BinderConfiguration {
|
||||
/**
|
||||
* @param binderType the binder type used by this configuration
|
||||
* @param properties the properties for setting up the binder
|
||||
* @param inheritEnvironment whether the binder should inherit the environment of the
|
||||
* module
|
||||
* @param defaultCandidate whether the binder is user defined
|
||||
* @param inheritEnvironment whether the binder should inherit the environment of the application
|
||||
* @param defaultCandidate whether the binder should be considered as a candidate when determining a default
|
||||
*/
|
||||
public BinderConfiguration(BinderType binderType, Properties properties, boolean inheritEnvironment,
|
||||
boolean defaultCandidate) {
|
||||
|
||||
@@ -113,9 +113,8 @@ public class DefaultBinderFactory<T> implements BinderFactory<T>, DisposableBean
|
||||
if (defaultCandidateConfigurations.size() > 1) {
|
||||
throw new IllegalStateException(
|
||||
"A default binder has been requested, but there is more than one binder available: "
|
||||
+ StringUtils
|
||||
.collectionToCommaDelimitedString(defaultCandidateConfigurations)
|
||||
+ ", and" + " no default binder has been set.");
|
||||
+ StringUtils.collectionToCommaDelimitedString(defaultCandidateConfigurations)
|
||||
+ ", and no default binder has been set.");
|
||||
}
|
||||
else {
|
||||
throw new IllegalStateException(
|
||||
@@ -131,7 +130,7 @@ public class DefaultBinderFactory<T> implements BinderFactory<T>, DisposableBean
|
||||
throw new IllegalStateException(
|
||||
"A default binder has been requested, but there is more than one binder available: "
|
||||
+ StringUtils.collectionToCommaDelimitedString(this.binderConfigurations.keySet())
|
||||
+ ", and" + " no default binder has been set.");
|
||||
+ ", and no default binder has been set.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BinderFactoryConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(BinderFactory.class)
|
||||
public BinderFactory binderFactory(BinderTypeRegistry binderTypeRegistry,
|
||||
public BinderFactory<?> binderFactory(BinderTypeRegistry binderTypeRegistry,
|
||||
ChannelBindingServiceProperties channelBindingServiceProperties) {
|
||||
Map<String, BinderConfiguration> binderConfigurations = new HashMap<>();
|
||||
Map<String, BinderProperties> declaredBinders = channelBindingServiceProperties.getBinders();
|
||||
@@ -71,7 +71,7 @@ public class BinderFactoryConfiguration {
|
||||
}
|
||||
else {
|
||||
Assert.hasText(binderProperties.getType(),
|
||||
"No 'type' property present for custom " + "binder " + binderEntry.getKey());
|
||||
"No 'type' property present for custom binder " + binderEntry.getKey());
|
||||
BinderType binderType = binderTypeRegistry.get(binderProperties.getType());
|
||||
Assert.notNull(binderType, "Binder type " + binderProperties.getType() + " is not defined");
|
||||
binderConfigurations.put(binderEntry.getKey(),
|
||||
@@ -85,7 +85,7 @@ public class BinderFactoryConfiguration {
|
||||
new BinderConfiguration(entry.getValue(), new Properties(), true, true));
|
||||
}
|
||||
}
|
||||
DefaultBinderFactory binderFactory = new DefaultBinderFactory<>(binderConfigurations);
|
||||
DefaultBinderFactory<?> binderFactory = new DefaultBinderFactory<>(binderConfigurations);
|
||||
binderFactory.setDefaultBinder(channelBindingServiceProperties.getDefaultBinder());
|
||||
return binderFactory;
|
||||
}
|
||||
@@ -126,7 +126,7 @@ public class BinderFactoryConfiguration {
|
||||
String binderType = (String) entry.getKey();
|
||||
String[] binderConfigurationClassNames = StringUtils
|
||||
.commaDelimitedListToStringArray((String) entry.getValue());
|
||||
Class[] binderConfigurationClasses = new Class[binderConfigurationClassNames.length];
|
||||
Class<?>[] binderConfigurationClasses = new Class[binderConfigurationClassNames.length];
|
||||
int i = 0;
|
||||
for (String binderConfigurationClassName : binderConfigurationClassNames) {
|
||||
binderConfigurationClasses[i++] = ClassUtils.forName(binderConfigurationClassName, classLoader);
|
||||
|
||||
Reference in New Issue
Block a user