11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2016 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
118118 * @see org.springframework.jms.listener.SessionAwareMessageListener
119119 * @see org.springframework.jms.listener.AbstractMessageListenerContainer#setMessageListener
120120 */
121- public class MessageListenerAdapter extends AbstractAdaptableMessageListener
122- implements SubscriptionNameProvider {
121+ public class MessageListenerAdapter extends AbstractAdaptableMessageListener implements SubscriptionNameProvider {
123122
124123 /**
125124 * Out-of-the-box value for the default listener method: "handleMessage".
@@ -135,19 +134,32 @@ public class MessageListenerAdapter extends AbstractAdaptableMessageListener
135134 /**
136135 * Create a new {@link MessageListenerAdapter} with default settings.
137136 */
137+ @ SuppressWarnings ("deprecation" )
138138 public MessageListenerAdapter () {
139+ initDefaultStrategies ();
139140 this .delegate = this ;
140141 }
141142
142143 /**
143144 * Create a new {@link MessageListenerAdapter} for the given delegate.
144145 * @param delegate the delegate object
145146 */
147+ @ SuppressWarnings ("deprecation" )
146148 public MessageListenerAdapter (Object delegate ) {
149+ initDefaultStrategies ();
147150 setDelegate (delegate );
148151 }
149152
150153
154+ /**
155+ * Initialize the default implementations for the adapter's strategies.
156+ * @deprecated as of 4.1, in favor of calling the corresponding setters
157+ * in the subclass constructor
158+ */
159+ @ Deprecated
160+ protected void initDefaultStrategies () {
161+ }
162+
151163 /**
152164 * Set a target object to delegate message listening to.
153165 * Specified listener methods have to be present on this target object.
@@ -184,6 +196,7 @@ protected String getDefaultListenerMethod() {
184196 return this .defaultListenerMethod ;
185197 }
186198
199+
187200 /**
188201 * Spring {@link SessionAwareMessageListener} entry point.
189202 * <p>Delegates the message to the target listener method, with appropriate
0 commit comments