INT-2961 Make ARPMH.onInit() Final; Add doInit()

https://jira.springsource.org/browse/INT-2961

onInit() relied on subclasses calling super.onInit() to apply the
advice chain and add the BeanFactory to the MessagingTemplate.

At least one extension (smpp) failed to do this, disabling these features.

Make onInit() final and call doInit() for subclass initialization (no-op in ARPMH).

INT-2961 Polishing

- do not increase visibility of doInit in subclasses.
- remove final modifiers from doInit so user subclasses can participate in initialization if needed.
This commit is contained in:
Gary Russell
2013-10-29 10:19:21 +02:00
committed by Artem Bilan
parent 182b232fda
commit 928b6b8bc3
19 changed files with 34 additions and 51 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -107,9 +107,7 @@ public class JdbcOutboundGateway extends AbstractReplyProducingMessageHandler im
}
@Override
protected void onInit() {
super.onInit();
protected void doInit() {
if (this.maxRowsPerPoll != null) {
Assert.notNull(poller, "If you want to set 'maxRowsPerPoll', then you must provide a 'selectQuery'.");
poller.setMaxRowsPerPoll(this.maxRowsPerPoll);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -88,8 +88,7 @@ public class StoredProcOutboundGateway extends AbstractReplyProducingMessageHand
* when {@link ProcedureParameter} are passed in.
*/
@Override
protected void onInit() {
super.onInit();
protected void doInit() {
};
@Override

View File

@@ -12,15 +12,14 @@
*/
package org.springframework.integration.jdbc;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;
import javax.sql.DataSource;
import org.junit.Assert;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
import org.springframework.jdbc.core.JdbcOperations;
import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
@@ -42,7 +41,7 @@ public class JdbcOutboundGatewayTests {
try {
jdbcOutboundGateway.setMaxRowsPerPoll(10);
jdbcOutboundGateway.onInit();
jdbcOutboundGateway.afterPropertiesSet();
} catch (IllegalArgumentException e) {
assertEquals("If you want to set 'maxRowsPerPoll', then you must provide a 'selectQuery'.", e.getMessage());