Skip to content

Commit

Permalink
Reintroduced initDefaultStrategies callback for compatibility with ol…
Browse files Browse the repository at this point in the history
…d MessageListenerAdapter subclasses

Issue: SPR-15043
  • Loading branch information
jhoeller committed Dec 22, 2016
1 parent 41b834f commit afe0228
Showing 1 changed file with 16 additions and 3 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2014 the original author or authors.
* Copyright 2002-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.
Expand Down Expand Up @@ -118,8 +118,7 @@
* @see org.springframework.jms.listener.SessionAwareMessageListener
* @see org.springframework.jms.listener.AbstractMessageListenerContainer#setMessageListener
*/
public class MessageListenerAdapter extends AbstractAdaptableMessageListener
implements SubscriptionNameProvider {
public class MessageListenerAdapter extends AbstractAdaptableMessageListener implements SubscriptionNameProvider {

/**
* Out-of-the-box value for the default listener method: "handleMessage".
Expand All @@ -135,19 +134,32 @@ public class MessageListenerAdapter extends AbstractAdaptableMessageListener
/**
* Create a new {@link MessageListenerAdapter} with default settings.
*/
@SuppressWarnings("deprecation")
public MessageListenerAdapter() {
initDefaultStrategies();
this.delegate = this;
}

/**
* Create a new {@link MessageListenerAdapter} for the given delegate.
* @param delegate the delegate object
*/
@SuppressWarnings("deprecation")
public MessageListenerAdapter(Object delegate) {
initDefaultStrategies();
setDelegate(delegate);
}


/**
* Initialize the default implementations for the adapter's strategies.
* @deprecated as of 4.1, in favor of calling the corresponding setters
* in the subclass constructor
*/
@Deprecated
protected void initDefaultStrategies() {
}

/**
* Set a target object to delegate message listening to.
* Specified listener methods have to be present on this target object.
Expand Down Expand Up @@ -184,6 +196,7 @@ protected String getDefaultListenerMethod() {
return this.defaultListenerMethod;
}


/**
* Spring {@link SessionAwareMessageListener} entry point.
* <p>Delegates the message to the target listener method, with appropriate
Expand Down

0 comments on commit afe0228

Please sign in to comment.