From c46135214e03fe6c44b0fd6f1bd1a7b0eaaa96a7 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Sun, 18 Feb 2018 15:57:11 -0500 Subject: [PATCH] GH-1230 General cleanup of BindingServiceConfiguration - removed BindableAdapter - removed ChannelBindingServiceProperties - other minor polishing Resolves #1230 --- .../cloud/stream/binding/BindableAdapter.java | 57 -------- .../binding/DynamicDestinationsBindable.java | 2 +- .../binding/SingleBindingTargetBindable.java | 2 +- .../config/BindingServiceConfiguration.java | 14 +- .../ChannelBindingServiceProperties.java | 129 ------------------ .../CompositeMessageConverterFactory.java | 1 + 6 files changed, 4 insertions(+), 201 deletions(-) delete mode 100644 spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableAdapter.java delete mode 100644 spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableAdapter.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableAdapter.java deleted file mode 100644 index 310fd2eec..000000000 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/BindableAdapter.java +++ /dev/null @@ -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 getInputs() { - return Collections.emptySet(); - } - - @Override - public Set getOutputs() { - return Collections.emptySet(); - } -} diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/DynamicDestinationsBindable.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/DynamicDestinationsBindable.java index 0a253bed3..a6cac38cd 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/DynamicDestinationsBindable.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/DynamicDestinationsBindable.java @@ -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. diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/SingleBindingTargetBindable.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/SingleBindingTargetBindable.java index aa1fbc757..a57ea0397 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/SingleBindingTargetBindable.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/binding/SingleBindingTargetBindable.java @@ -29,7 +29,7 @@ import java.util.Set; * @author Ilayaperumal Gopinathan * @author Marius Bogoevici */ -public class SingleBindingTargetBindable extends BindableAdapter { +public class SingleBindingTargetBindable implements Bindable { private final String name; diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceConfiguration.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceConfiguration.java index a165a4325..a7c40536a 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceConfiguration.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/BindingServiceConfiguration.java @@ -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 channelResolver) { diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java deleted file mode 100644 index 47dc63d05..000000000 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/config/ChannelBindingServiceProperties.java +++ /dev/null @@ -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 getBindings() { - return bindingServiceProperties.getBindings(); - } - - public void setBindings(Map bindings) { - bindingServiceProperties.setBindings(bindings); - } - - public Map getBinders() { - return bindingServiceProperties.getBinders(); - } - - public void setBinders(Map 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 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); - } -} diff --git a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CompositeMessageConverterFactory.java b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CompositeMessageConverterFactory.java index e8f41f5f2..d1a9ca429 100644 --- a/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CompositeMessageConverterFactory.java +++ b/spring-cloud-stream/src/main/java/org/springframework/cloud/stream/converter/CompositeMessageConverterFactory.java @@ -68,6 +68,7 @@ public class CompositeMessageConverterFactory { initDefaultConverters(); } + @SuppressWarnings("deprecation") private void initDefaultConverters() { ApplicationJsonMessageMarshallingConverter applicationJson = new ApplicationJsonMessageMarshallingConverter(); applicationJson.setStrictContentTypeMatch(true);