Annotate channelbinding properties instead of autoconfig

- Autowire `ChannelBindingProperties` into `ChannelBindingConfiguration` via
`@EnableConfigurationProperties` support
  - This change removes explicit `@AutoConfiguration` for ChannelBindingProperties
This commit is contained in:
Ilayaperumal Gopinathan
2015-08-20 08:38:04 -07:00
committed by Eric Bottard
parent 44bf181ff0
commit b0beec8548
4 changed files with 3 additions and 40 deletions

View File

@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.stream.adapter.ChannelBindingAdapter;
import org.springframework.cloud.stream.adapter.DefaultChannelLocator;
import org.springframework.cloud.stream.adapter.InputChannelBinding;
@@ -50,6 +51,7 @@ import org.springframework.messaging.core.DestinationResolver;
* @author Ilayaperumal Gopinathan
*/
@Configuration
@EnableConfigurationProperties(ChannelBindingProperties.class)
public class ChannelBindingAdapterConfiguration {
@Autowired

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2015 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 org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* @author Dave Syer
*
*/
@Configuration
@ConditionalOnMissingBean(value = ChannelBindingProperties.class, search = SearchStrategy.CURRENT)
public class ChannelBindingPropertiesAutoConfiguration {
@Bean(name = "spring.cloud.stream.CONFIGURATION_PROPERTIES")
public ChannelBindingProperties moduleProperties() {
return new ChannelBindingProperties();
}
}

View File

@@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration:\
org.springframework.cloud.stream.config.ChannelBindingPropertiesAutoConfiguration

View File

@@ -132,7 +132,7 @@ public class ChannelBindingAdapterConfigurationTests {
}
@Configuration
@Import({ChannelBindingAdapterConfiguration.class, ChannelBindingPropertiesAutoConfiguration.class})
@Import({ChannelBindingAdapterConfiguration.class})
protected static class Empty {
@Bean
public LocalMessageChannelBinder binder() {