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

@@ -218,9 +218,7 @@ public class FileWritingMessageHandler extends AbstractReplyProducingMessageHand
}
@Override
public final void onInit() {
super.onInit();
protected void doInit() {
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.getBeanFactory());

View File

@@ -286,8 +286,7 @@ public abstract class AbstractRemoteFileOutboundGateway<F> extends AbstractReply
@Override
protected void onInit() {
super.onInit();
protected void doInit() {
Assert.notNull(this.command, "command must not be null");
if (Command.RM.equals(this.command) ||
Command.GET.equals(this.command)) {

View File

@@ -78,7 +78,7 @@ public class RemoteFileOutboundGatewayTests {
(sessionFactory, "get", "payload");
gw.setFilter(new TestPatternFilter(""));
try {
gw.onInit();
gw.afterPropertiesSet();
fail("Exception expected");
}
catch (IllegalArgumentException e) {
@@ -93,7 +93,7 @@ public class RemoteFileOutboundGatewayTests {
(sessionFactory, "rm", "payload");
gw.setFilter(new TestPatternFilter(""));
try {
gw.onInit();
gw.afterPropertiesSet();
fail("Exception expected");
}
catch (IllegalArgumentException e) {