GH-274 Fixes for AggregatedApplication

Resolves #274.

* Handle @Autowired(required=false) correctly when no `Bindable` beans are present (i.e. aggregated root context)
* Ensure separate domains per subcontext
* Register shared channels internally with the proxy

Update copyrights and address comments
This commit is contained in:
Marius Bogoevici
2016-01-12 22:22:13 -05:00
committed by Ilayaperumal Gopinathan
parent 8036c6712e
commit c300c95be1
3 changed files with 11 additions and 5 deletions

View File

@@ -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.
@@ -111,6 +111,7 @@ public class AggregateApplication {
return new SpringApplicationBuilder(module)
.web(false)
.bannerMode(Mode.OFF)
.properties("spring.jmx.default-domain=" + module)
.properties(CHANNEL_NAMESPACE_PROPERTY_NAME + "=" + namespace)
.registerShutdownHook(false)
.parent(applicationContext);

View File

@@ -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.
@@ -131,6 +131,7 @@ public class BindableProxyFactory implements MethodInterceptor, FactoryBean<Obje
inputHolders.put(name, new ChannelHolder(createBindableChannel(name, channelType), true));
}
else {
inputHolders.put(name, new ChannelHolder(sharedChannel, false));
if (!channelType.isAssignableFrom(sharedChannel.getClass())) {
bridgeSharedChannel(channelType, sharedChannel);
}
@@ -150,6 +151,7 @@ public class BindableProxyFactory implements MethodInterceptor, FactoryBean<Obje
outputHolders.put(name, new ChannelHolder(createBindableChannel(name, channelType), true));
}
else {
outputHolders.put(name, new ChannelHolder(sharedChannel, false));
if (!channelType.isAssignableFrom(sharedChannel.getClass())) {
bridgeSharedChannel(channelType, sharedChannel);
}

View File

@@ -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.
@@ -35,6 +35,7 @@ import org.springframework.messaging.MessageChannel;
* general Spring Integration infrastructure.
*
* @author Dave Syer
* @author Marius Bogoevici
*/
@Configuration
@ConditionalOnBean(ChannelBindingService.class)
@@ -44,6 +45,9 @@ public class ChannelBindingAutoConfiguration {
@Autowired
private DefaultPollerProperties poller;
@Autowired(required = false)
private List<Bindable> adapters;
@Bean(name = PollerMetadata.DEFAULT_POLLER)
@ConditionalOnMissingBean(PollerMetadata.class)
public PollerMetadata defaultPoller() {
@@ -51,8 +55,7 @@ public class ChannelBindingAutoConfiguration {
}
@Bean
@Autowired(required=false)
public ChannelsEndpoint channelsEndpoint(List<Bindable> adapters, ChannelBindingServiceProperties properties) {
public ChannelsEndpoint channelsEndpoint(ChannelBindingServiceProperties properties) {
return new ChannelsEndpoint(adapters, properties);
}