GH-1230 General cleanup of BindingServiceConfiguration

- removed BindableAdapter
- removed ChannelBindingServiceProperties
- other minor polishing

Resolves #1230
This commit is contained in:
Oleg Zhurakousky
2018-02-18 15:57:11 -05:00
parent 9dde0602e6
commit c46135214e
6 changed files with 4 additions and 201 deletions

View File

@@ -1,57 +0,0 @@
/*
* Copyright 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.
* 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.stream.binding;
import java.util.Collections;
import java.util.Set;
/**
* Default adapter implementation for {@Bindable}.
*
* @author Ilayaperumal Gopinathan
*
* @deprecated as of version 2.0. Use {@link Bindable} interface instead.
*/
@Deprecated
public class BindableAdapter implements Bindable {
@Override
public void bindInputs(BindingService adapter) {
}
@Override
public void bindOutputs(BindingService adapter) {
}
@Override
public void unbindInputs(BindingService adapter) {
}
@Override
public void unbindOutputs(BindingService adapter) {
}
@Override
public Set<String> getInputs() {
return Collections.emptySet();
}
@Override
public Set<String> getOutputs() {
return Collections.emptySet();
}
}

View File

@@ -24,7 +24,7 @@ import java.util.Set;
import org.springframework.cloud.stream.binder.Binding;
/**
* A {@link BindableAdapter} that stores the dynamic destination names and handles their
* A {@link Bindable} that stores the dynamic destination names and handles their
* unbinding.
*
* This class is not thread-safe.

View File

@@ -29,7 +29,7 @@ import java.util.Set;
* @author Ilayaperumal Gopinathan
* @author Marius Bogoevici
*/
public class SingleBindingTargetBindable<T> extends BindableAdapter {
public class SingleBindingTargetBindable<T> implements Bindable {
private final String name;

View File

@@ -208,21 +208,9 @@ public class BindingServiceConfiguration {
}
/**
*
* @deprecated as of version 2.0
*/
@Bean
@Deprecated
// provided for backwards compatibility scenarios
public ChannelBindingServiceProperties channelBindingServiceProperties(
BindingServiceProperties bindingServiceProperties) {
return new ChannelBindingServiceProperties(bindingServiceProperties);
}
@SuppressWarnings("deprecation")
@Bean
@ConditionalOnMissingBean
@SuppressWarnings("deprecation")
public org.springframework.cloud.stream.binding.BinderAwareRouterBeanPostProcessor binderAwareRouterBeanPostProcessor(
@Autowired(required=false) AbstractMappingMessageRouter[] routers,
@Autowired(required=false)DestinationResolver<MessageChannel> channelResolver) {

View File

@@ -1,129 +0,0 @@
/*
* Copyright 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.
* 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.stream.config;
import java.util.Map;
import org.springframework.beans.BeansException;
import org.springframework.cloud.stream.binder.ConsumerProperties;
import org.springframework.cloud.stream.binder.ProducerProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.core.convert.ConversionService;
/**
* Provides a wrapper around {@link BindingServiceProperties} for backwards compatibility.
* @author Marius Bogoevici
*/
@Deprecated
public class ChannelBindingServiceProperties {
private final BindingServiceProperties bindingServiceProperties;
public ChannelBindingServiceProperties(
BindingServiceProperties bindingServiceProperties) {
this.bindingServiceProperties = bindingServiceProperties;
}
public Map<String, BindingProperties> getBindings() {
return bindingServiceProperties.getBindings();
}
public void setBindings(Map<String, BindingProperties> bindings) {
bindingServiceProperties.setBindings(bindings);
}
public Map<String, BinderProperties> getBinders() {
return bindingServiceProperties.getBinders();
}
public void setBinders(Map<String, BinderProperties> binders) {
bindingServiceProperties.setBinders(binders);
}
public String getDefaultBinder() {
return bindingServiceProperties.getDefaultBinder();
}
public void setDefaultBinder(String defaultBinder) {
bindingServiceProperties.setDefaultBinder(defaultBinder);
}
public int getInstanceIndex() {
return bindingServiceProperties.getInstanceIndex();
}
public void setInstanceIndex(int instanceIndex) {
bindingServiceProperties.setInstanceIndex(instanceIndex);
}
public int getInstanceCount() {
return bindingServiceProperties.getInstanceCount();
}
public void setInstanceCount(int instanceCount) {
bindingServiceProperties.setInstanceCount(instanceCount);
}
public String[] getDynamicDestinations() {
return bindingServiceProperties.getDynamicDestinations();
}
public void setDynamicDestinations(String[] dynamicDestinations) {
bindingServiceProperties.setDynamicDestinations(dynamicDestinations);
}
public void setApplicationContext(ApplicationContext applicationContext)
throws BeansException {
bindingServiceProperties.setApplicationContext(applicationContext);
}
public void setConversionService(ConversionService conversionService) {
bindingServiceProperties.setConversionService(conversionService);
}
public void afterPropertiesSet() throws Exception {
bindingServiceProperties.afterPropertiesSet();
}
public String getBinder(String channelName) {
return bindingServiceProperties.getBinder(channelName);
}
public Map<String, Object> asMapProperties() {
return bindingServiceProperties.asMapProperties();
}
public ConsumerProperties getConsumerProperties(String inputChannelName) {
return bindingServiceProperties.getConsumerProperties(inputChannelName);
}
public ProducerProperties getProducerProperties(String outputChannelName) {
return bindingServiceProperties.getProducerProperties(outputChannelName);
}
public BindingProperties getBindingProperties(String channelName) {
return bindingServiceProperties.getBindingProperties(channelName);
}
public String getGroup(String channelName) {
return bindingServiceProperties.getGroup(channelName);
}
public String getBindingDestination(String channelName) {
return bindingServiceProperties.getBindingDestination(channelName);
}
}

View File

@@ -68,6 +68,7 @@ public class CompositeMessageConverterFactory {
initDefaultConverters();
}
@SuppressWarnings("deprecation")
private void initDefaultConverters() {
ApplicationJsonMessageMarshallingConverter applicationJson = new ApplicationJsonMessageMarshallingConverter();
applicationJson.setStrictContentTypeMatch(true);