Renamed EnableModule to EnableBinding

* renamed @ModuleChannels to @Bindings
* moved Source, Sink, and Processor to the `org.springframework.cloud.stream.messaging` package
* updated documentation
This commit is contained in:
Marius Bogoevici
2015-09-02 16:33:03 -04:00
committed by Mark Fisher
parent 0fd1e37a8f
commit 86e457fac4
30 changed files with 137 additions and 111 deletions

View File

@@ -2,7 +2,7 @@
image::https://travis-ci.org/spring-cloud/spring-cloud-stream.svg?branch=master[Build Status, link=https://travis-ci.org/spring-cloud/spring-cloud-stream]
This project allows a user to develop and run messaging microservices using Spring Integration and run them locally, or in the cloud, or even on Spring XD. Just add `@EnableModule` and run your app as a Spring Boot app (single application context). You just need to connect to the physical broker for the bus, which is automatic if the relevant bus implementation is available on the classpath. The sample uses Redis.
This project allows a user to develop and run messaging microservices using Spring Integration and run them locally, or in the cloud, or even on Spring XD. Just add `@EnableBinding` and run your app as a Spring Boot app (single application context). You just need to connect to the physical broker for the bindings, which is automatic if the relevant binder implementation is available on the classpath. The sample uses Redis.
Here's a sample source module (output channel only):
@@ -19,7 +19,7 @@ public class ModuleApplication {
}
@Configuration
@EnableModule(Source.class)
@EnableBinding(Source.class)
public class TimerSource {
@Value("${format}")
@@ -34,7 +34,7 @@ public class TimerSource {
}
----
`@EnableModule` is parameterized by an interface (in this case `Source`) which declares input and output channels. `Source`, `Sink` and `Processor` are provided off the shelf, but you can define others. Here's the definition of `Source`
`@EnableBinding` is parameterized by an interface (in this case `Source`) which declares input and output channels. `Source`, `Sink` and `Processor` are provided off the shelf, but you can define others. Here's the definition of `Source`:
[source,java]
----
@@ -65,7 +65,7 @@ public class ModuleApplicationTests {
}
----
NOTE: In this case there is only one `Source` in the application context so there is no need to qualify it when it is autowired. If there is ambiguity, e.g. if you are composing one module from some others, you can use `@ModuleChannels` qualifier to inject a specific channel set. The `@ModuleChannels` qualifier takes a parameter which is the class that carries the `@EnableModule` annotation (in this case the `TimerSource`).
NOTE: In this case there is only one `Source` in the application context so there is no need to qualify it when it is autowired. If there is ambiguity, e.g. if you are composing one module from some others, you can use `@Bindings` qualifier to inject a specific channel set. The `@Bindings` qualifier takes a parameter which is the class that carries the `@EnableBinding` annotation (in this case the `TimerSource`).
== Multiple Input or Output Channels

View File

@@ -1,4 +1,4 @@
This project allows a user to develop and run messaging microservices using Spring Integration and run them locally, or in the cloud, or even on Spring XD. Just add `@EnableModule` and run your app as a Spring Boot app (single application context). You just need to connect to the physical broker for the bus, which is automatic if the relevant bus implementation is available on the classpath. The sample uses Redis.
This project allows a user to develop and run messaging microservices using Spring Integration and run them locally, or in the cloud, or even on Spring XD. Just add `@EnableBinding` and run your app as a Spring Boot app (single application context). You just need to connect to the physical broker for the bindings, which is automatic if the relevant binder implementation is available on the classpath. The sample uses Redis.
Here's a sample source module (output channel only):
@@ -15,7 +15,7 @@ public class ModuleApplication {
}
@Configuration
@EnableModule(Source.class)
@EnableBinding(Source.class)
public class TimerSource {
@Value("${format}")
@@ -30,7 +30,7 @@ public class TimerSource {
}
----
`@EnableModule` is parameterized by an interface (in this case `Source`) which declares input and output channels. `Source`, `Sink` and `Processor` are provided off the shelf, but you can define others. Here's the definition of `Source`
`@EnableBinding` is parameterized by an interface (in this case `Source`) which declares input and output channels. `Source`, `Sink` and `Processor` are provided off the shelf, but you can define others. Here's the definition of `Source`:
[source,java]
----
@@ -61,7 +61,7 @@ public class ModuleApplicationTests {
}
----
NOTE: In this case there is only one `Source` in the application context so there is no need to qualify it when it is autowired. If there is ambiguity, e.g. if you are composing one module from some others, you can use `@ModuleChannels` qualifier to inject a specific channel set. The `@ModuleChannels` qualifier takes a parameter which is the class that carries the `@EnableModule` annotation (in this case the `TimerSource`).
NOTE: In this case there is only one `Source` in the application context so there is no need to qualify it when it is autowired. If there is ambiguity, e.g. if you are composing one module from some others, you can use `@Bindings` qualifier to inject a specific channel set. The `@Bindings` qualifier takes a parameter which is the class that carries the `@EnableBinding` annotation (in this case the `TimerSource`).
== Multiple Input or Output Channels

View File

@@ -18,15 +18,15 @@ package config.sink;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.integration.annotation.ServiceActivator;
/**
* @author Dave Syer
* @author Marius Bogoevici
*/
@EnableModule(Sink.class)
@EnableBinding(Sink.class)
public class SinkModuleDefinition {
private static Logger logger = LoggerFactory.getLogger(SinkModuleDefinition.class);

View File

@@ -19,9 +19,8 @@ package config.source;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Source;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
@@ -32,7 +31,7 @@ import org.springframework.messaging.support.GenericMessage;
* @author Dave Syer
* @author Marius Bogoevici
*/
@EnableModule(Source.class)
@EnableBinding(Source.class)
public class SourceModuleDefinition {
private String format = "yyyy-MM-dd HH:mm:ss";

View File

@@ -18,15 +18,15 @@ package demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.integration.annotation.ServiceActivator;
/**
* @author Dave Syer
*
*/
@EnableModule(Sink.class)
@EnableBinding(Sink.class)
public class LogSink {
private static Logger logger = LoggerFactory.getLogger(LogSink.class);

View File

@@ -22,10 +22,10 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.Source;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.MessageChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -38,7 +38,7 @@ import org.springframework.test.context.web.WebAppConfiguration;
public class ModuleApplicationTests {
@Autowired
@ModuleChannels(LogSink.class)
@Bindings(LogSink.class)
private Sink sink;
@Autowired

View File

@@ -21,8 +21,8 @@ import java.util.Date;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Source;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.annotation.Bean;
import org.springframework.integration.annotation.InboundChannelAdapter;
import org.springframework.integration.annotation.Poller;
@@ -34,7 +34,7 @@ import org.springframework.messaging.support.GenericMessage;
* @author Glenn Renfro
*
*/
@EnableModule(Source.class)
@EnableBinding(Source.class)
@EnableConfigurationProperties(TimeSourceOptionsMetadata.class)
public class TimeSource {

View File

@@ -18,15 +18,15 @@ package demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.integration.annotation.ServiceActivator;
/**
* @author Dave Syer
* @author Marius Bogoevici
*/
@EnableModule(Sink.class)
@EnableBinding(Sink.class)
public class TappingLoggingSink {
private static Logger logger = LoggerFactory.getLogger(TappingLoggingSink.class);

View File

@@ -19,15 +19,15 @@ package demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Processor;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.integration.annotation.ServiceActivator;
/**
* @author Dave Syer
*
*/
@EnableModule(Processor.class)
@EnableBinding(Processor.class)
@ConfigurationProperties("module.logging")
public class LoggingTransformer {

View File

@@ -38,7 +38,7 @@ import org.springframework.messaging.Message;
* public class TransformProcessorApplicationTests {
*
* {@literal @}Autowired
* {@literal @}ModuleChannels(TransformProcessor.class)
* {@literal @}Bindings(TransformProcessor.class)
* private Processor processor;
*
* {@literal @}Autowired

View File

@@ -26,11 +26,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.IntegrationTest;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Processor;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.cloud.stream.test.binder.MessageCollector;
import org.springframework.cloud.stream.test.binder.TestSupportBinder;
import org.springframework.integration.annotation.Transformer;
import org.springframework.messaging.Message;
import org.springframework.messaging.support.GenericMessage;
@@ -48,7 +47,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
public class ExampleTest {
@Autowired
@ModuleChannels(MyProcessor.class)
@Bindings(MyProcessor.class)
private Processor processor;
@Autowired
@@ -65,7 +64,7 @@ public class ExampleTest {
@SpringBootApplication
@EnableModule(Processor.class)
@EnableBinding(Processor.class)
public static class MyProcessor {
@Autowired

View File

@@ -19,10 +19,10 @@ package org.springframework.cloud.stream.aggregate;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Processor;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.Source;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.cloud.stream.binding.BindableProxyFactory;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -129,7 +129,7 @@ public class AggregateApplication {
* Basic configuration for a parent
*/
@EnableAutoConfiguration
@EnableModule
@EnableBinding
public static class AggregatorParentConfiguration {
@Bean

View File

@@ -26,10 +26,11 @@ import java.lang.annotation.Target;
import org.springframework.beans.factory.annotation.Qualifier;
/**
* Indicates an instance of a channels interface containing methods returning named
* message channels.
* Indicates an instance of an interface containing methods returning bound
* inputs and outputs.
*
* @author Dave Syer
* @author Marius Bogoevici
*/
@Qualifier
@@ -37,7 +38,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
@Retention(RetentionPolicy.RUNTIME)
@Inherited
@Documented
public @interface ModuleChannels {
public @interface Bindings {
Class<?> value();

View File

@@ -31,7 +31,8 @@ import org.springframework.context.annotation.Import;
import org.springframework.integration.config.EnableIntegration;
/**
* Annotation that identifies a class as a module.
* Enables the binding of inputs and outputs to a broker, according to the list
* of interfaces passed as value to the annotation.
*
* @author Dave Syer
* @author Marius Bogoevici
@@ -44,8 +45,12 @@ import org.springframework.integration.config.EnableIntegration;
@Configuration
@Import({ChannelBindingServiceConfiguration.class, AggregateBuilderConfiguration.class, BindingBeansRegistrar.class})
@EnableIntegration
public @interface EnableModule {
public @interface EnableBinding {
/**
* A list of interfaces having methods annotated with {@link Input} and/or
* {@link Output} to indicate bindable components.
*/
Class<?>[] value() default {};
}

View File

@@ -35,6 +35,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.cloud.stream.aggregate.SharedChannelRegistry;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.cloud.stream.binder.MessageChannelBinderSupport;
@@ -52,12 +53,12 @@ import org.springframework.util.ReflectionUtils;
/**
* {@link FactoryBean} for instantiating the interfaces specified via
* {@link org.springframework.cloud.stream.annotation.EnableModule}
* {@link EnableBinding}
*
* @author Marius Bogoevici
* @author David Syer
*
* @see org.springframework.cloud.stream.annotation.EnableModule
* @see EnableBinding
*/
public class BindableProxyFactory implements MethodInterceptor, FactoryBean<Object>,
BeanFactoryAware, Bindable, InitializingBean {

View File

@@ -25,8 +25,8 @@ import java.util.Map;
import org.springframework.beans.factory.support.AutowireCandidateQualifier;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.util.ReflectionUtils;
@@ -70,7 +70,6 @@ public abstract class BindingBeanDefinitionRegistryUtils {
public static void registerChannelBeanDefinitions(Class<?> type,
final String channelInterfaceBeanName, final BeanDefinitionRegistry registry) {
final List<String> channelNames = new ArrayList<>();
ReflectionUtils.doWithMethods(type, new MethodCallback() {
@Override
public void doWith(Method method) throws IllegalArgumentException,
@@ -99,7 +98,7 @@ public abstract class BindingBeanDefinitionRegistryUtils {
RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(
BindableProxyFactory.class);
rootBeanDefinition.addQualifier(new AutowireCandidateQualifier(
ModuleChannels.class, parent));
Bindings.class, parent));
rootBeanDefinition.getConstructorArgumentValues().addGenericArgumentValue(
type);
registry.registerBeanDefinition(type.getName(), rootBeanDefinition);
@@ -107,7 +106,7 @@ public abstract class BindingBeanDefinitionRegistryUtils {
else {
RootBeanDefinition rootBeanDefinition = new RootBeanDefinition(type);
rootBeanDefinition.addQualifier(new AutowireCandidateQualifier(
ModuleChannels.class, parent));
Bindings.class, parent));
registry.registerBeanDefinition(type.getName(), rootBeanDefinition);
}
}

View File

@@ -20,7 +20,7 @@ import java.util.ArrayList;
import java.util.List;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.binding.BindingBeanDefinitionRegistryUtils;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;
@@ -37,9 +37,8 @@ public class BindingBeansRegistrar implements ImportBeanDefinitionRegistrar {
@Override
public void registerBeanDefinitions(AnnotationMetadata metadata,
BeanDefinitionRegistry registry) {
MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(
EnableModule.class.getName(), false);
List<String> registeredChannelNames = new ArrayList<>();
MultiValueMap<String, Object> attributes = metadata.getAllAnnotationAttributes(EnableBinding.class.getName(),
false);
for (Class<?> type : collectClasses(attributes.get("value"))) {
BindingBeanDefinitionRegistryUtils.registerChannelBeanDefinitions(type, type.getName(), registry);
BindingBeanDefinitionRegistryUtils.registerChannelsQualifiedBeanDefinitions(

View File

@@ -14,8 +14,15 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.annotation;
package org.springframework.cloud.stream.messaging;
/**
* Bindable interface with one input and one output channel.
*
* @see org.springframework.cloud.stream.annotation.EnableBinding
* @author Dave Syer
* @author Marius Bogoevici
*/
public interface Processor extends Source, Sink {
}

View File

@@ -14,13 +14,21 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.annotation;
package org.springframework.cloud.stream.messaging;
import org.springframework.cloud.stream.annotation.Input;
import org.springframework.messaging.SubscribableChannel;
/**
* Bindable interface with one input channel.
*
* @see org.springframework.cloud.stream.annotation.EnableBinding
* @author Dave Syer
* @author Marius Bogoevici
*/
public interface Sink {
public static String INPUT = "input";
String INPUT = "input";
@Input(Sink.INPUT)
SubscribableChannel input();

View File

@@ -14,13 +14,21 @@
* limitations under the License.
*/
package org.springframework.cloud.stream.annotation;
package org.springframework.cloud.stream.messaging;
import org.springframework.cloud.stream.annotation.Output;
import org.springframework.messaging.MessageChannel;
/**
* Bindable interface with one output channel.
*
* @see org.springframework.cloud.stream.annotation.EnableBinding
* @author Dave Syer
* @author Marius Bogoevici
*/
public interface Source {
public static String OUTPUT = "output";
String OUTPUT = "output";
@Output(Source.OUTPUT)
MessageChannel output();

View File

@@ -25,9 +25,9 @@ import org.junit.Test;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.stream.aggregate.AggregateApplication;
import org.springframework.cloud.stream.aggregate.SharedChannelRegistry;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.Processor;
import org.springframework.cloud.stream.annotation.Source;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.context.ConfigurableApplicationContext;
/**
@@ -46,13 +46,13 @@ public class ModuleAggregationTest {
}
@EnableModule(Source.class)
@EnableBinding(Source.class)
@EnableAutoConfiguration
public static class TestSource {
}
@EnableModule(Processor.class)
@EnableBinding(Processor.class)
@EnableAutoConfiguration
public static class TestProcessor {

View File

@@ -29,8 +29,8 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
@@ -44,7 +44,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
public class ArbitraryInterfaceBindingTestsWithBindingTargets {
@Autowired
@ModuleChannels(ArbitraryInterfaceBindingTestsWithBindingTargets.TestFooChannels.class)
@Bindings(ArbitraryInterfaceBindingTestsWithBindingTargets.TestFooChannels.class)
public FooChannels fooChannels;
@SuppressWarnings("rawtypes")
@@ -61,7 +61,7 @@ public class ArbitraryInterfaceBindingTestsWithBindingTargets {
verifyNoMoreInteractions(binder);
}
@EnableModule(FooChannels.class)
@EnableBinding(FooChannels.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
@PropertySource("classpath:/org/springframework/cloud/stream/binder/arbitrary-binding-test.properties")

View File

@@ -29,8 +29,8 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -43,7 +43,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
public class ArbitraryInterfaceBindingTestsWithDefaults {
@Autowired
@ModuleChannels(ArbitraryInterfaceBindingTestsWithDefaults.TestFooChannels.class)
@Bindings(ArbitraryInterfaceBindingTestsWithDefaults.TestFooChannels.class)
public FooChannels fooChannels;
@SuppressWarnings("rawtypes")
@@ -60,7 +60,7 @@ public class ArbitraryInterfaceBindingTestsWithDefaults {
verifyNoMoreInteractions(binder);
}
@EnableModule(FooChannels.class)
@EnableBinding(FooChannels.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
public static class TestFooChannels {

View File

@@ -28,9 +28,9 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Processor;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
@@ -47,7 +47,7 @@ public class ProcessorBindingTestsWithBindingTargets {
@Autowired
private Binder binder;
@Autowired @ModuleChannels(TestProcessor.class)
@Autowired @Bindings(TestProcessor.class)
private Processor testProcessor;
@SuppressWarnings("unchecked")
@@ -57,7 +57,7 @@ public class ProcessorBindingTestsWithBindingTargets {
verify(binder).bindProducer(eq("testtock.1"), eq(testProcessor.output()), Mockito.<Properties>any());
}
@EnableModule(Processor.class)
@EnableBinding(Processor.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
@PropertySource("classpath:/org/springframework/cloud/stream/binder/processor-binding-test.properties")

View File

@@ -28,9 +28,9 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Processor;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.messaging.Processor;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -46,7 +46,7 @@ public class ProcessorBindingTestsWithDefaults {
@Autowired
private Binder binder;
@Autowired @ModuleChannels(TestProcessor.class)
@Autowired @Bindings(TestProcessor.class)
private Processor processor;
@SuppressWarnings("unchecked")
@@ -57,7 +57,7 @@ public class ProcessorBindingTestsWithDefaults {
verifyNoMoreInteractions(binder);
}
@EnableModule(Processor.class)
@EnableBinding(Processor.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
public static class TestProcessor {

View File

@@ -29,9 +29,9 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
@@ -48,7 +48,7 @@ public class SinkBindingTestsWithBindingTargets {
@Autowired
private Binder binder;
@Autowired @ModuleChannels(TestSink.class)
@Autowired @Bindings(TestSink.class)
private Sink testSink;
@SuppressWarnings("unchecked")
@@ -58,7 +58,7 @@ public class SinkBindingTestsWithBindingTargets {
verifyNoMoreInteractions(binder);
}
@EnableModule(Sink.class)
@EnableBinding(Sink.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
@PropertySource("classpath:/org/springframework/cloud/stream/binder/sink-binding-test.properties")

View File

@@ -29,9 +29,9 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -47,7 +47,7 @@ public class SinkBindingTestsWithDefaults {
@Autowired
private Binder binder;
@Autowired @ModuleChannels(TestSink.class)
@Autowired @Bindings(TestSink.class)
private Sink testSink;
@SuppressWarnings("unchecked")
@@ -57,7 +57,7 @@ public class SinkBindingTestsWithDefaults {
verifyNoMoreInteractions(binder);
}
@EnableModule(Sink.class)
@EnableBinding(Sink.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
public static class TestSink {

View File

@@ -29,9 +29,9 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Source;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.PropertySource;
@@ -48,7 +48,7 @@ public class SourceBindingTestsWithBindingTargets {
@Autowired
private Binder binder;
@Autowired @ModuleChannels(TestSource.class)
@Autowired @Bindings(TestSource.class)
private Source testSource;
@SuppressWarnings("unchecked")
@@ -58,7 +58,7 @@ public class SourceBindingTestsWithBindingTargets {
verifyNoMoreInteractions(binder);
}
@EnableModule(Source.class)
@EnableBinding(Source.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
@PropertySource("classpath:/org/springframework/cloud/stream/binder/source-binding-test.properties")

View File

@@ -29,9 +29,9 @@ import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Source;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -47,7 +47,7 @@ public class SourceBindingTestsWithDefaults {
@Autowired
private Binder binder;
@Autowired @ModuleChannels(TestSource.class)
@Autowired @Bindings(TestSource.class)
private Source testSource;
@SuppressWarnings("unchecked")
@@ -57,7 +57,7 @@ public class SourceBindingTestsWithDefaults {
verifyNoMoreInteractions(binder);
}
@EnableModule(Source.class)
@EnableBinding(Source.class)
@EnableAutoConfiguration
@Import(MockBinderConfiguration.class)
public static class TestSource {

View File

@@ -25,9 +25,9 @@ import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.cloud.stream.annotation.EnableModule;
import org.springframework.cloud.stream.annotation.ModuleChannels;
import org.springframework.cloud.stream.annotation.Sink;
import org.springframework.cloud.stream.annotation.Bindings;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.cloud.stream.utils.MockBinderConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
@@ -53,7 +53,7 @@ public class BoundChannelsInterceptedTest {
ChannelInterceptor channelInterceptor;
@Autowired
@ModuleChannels(BoundChannelsInterceptedTest.Foo.class)
@Bindings(BoundChannelsInterceptedTest.Foo.class)
public Sink fooSink;
@Test
@@ -65,7 +65,7 @@ public class BoundChannelsInterceptedTest {
@SpringBootApplication
@EnableModule(Sink.class)
@EnableBinding(Sink.class)
@Import(MockBinderConfiguration.class)
public static class Foo {