AbstractBinder's afterPropertiesSet() is now final

- subclasses should implement the new onInit() method instead of overriding
- avoids the potential for a NPE in case an overriding subclass did not call the superclass method
This commit is contained in:
Mark Fisher
2016-03-02 13:29:49 -05:00
parent 9f9bc66345
commit 2bc59a184a
4 changed files with 14 additions and 9 deletions

View File

@@ -325,7 +325,7 @@ public class KafkaMessageChannelBinder extends AbstractBinder<MessageChannel> {
}
@Override
public void afterPropertiesSet() throws Exception {
public void onInit() throws Exception {
// we instantiate the connection factory here due to https://jira.spring.io/browse/XD-2647
ZookeeperConfiguration configuration = new ZookeeperConfiguration(this.zookeeperConnect);
configuration.setBufferSize(socketBufferSize);
@@ -348,7 +348,6 @@ public class KafkaMessageChannelBinder extends AbstractBinder<MessageChannel> {
retryTemplate.setBackOffPolicy(backOffPolicy);
retryOperations = retryTemplate;
}
super.afterPropertiesSet();
}
/**

View File

@@ -393,8 +393,7 @@ public class RabbitMessageChannelBinder extends AbstractBinder<MessageChannel> {
}
@Override
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
public void onInit() {
if (this.clustered) {
Assert.state(this.addresses.length == this.adminAddresses.length
&& this.addresses.length == this.nodes.length,

View File

@@ -132,8 +132,7 @@ public class RedisMessageChannelBinder extends AbstractBinder<MessageChannel> {
}
@Override
public void afterPropertiesSet() throws Exception {
super.afterPropertiesSet();
public void onInit() {
this.errorAdapter.setIntegrationEvaluationContext(this.evaluationContext);
this.errorAdapter.setBeanFactory(getBeanFactory());
this.errorAdapter.afterPropertiesSet();