@@ -209,7 +209,7 @@ public void doWith(Method method) throws IllegalArgumentException, IllegalAccess
209209 if (annotatedMethods .isEmpty ()) {
210210 this .nonAnnotatedClasses .add (bean .getClass ());
211211 if (logger .isTraceEnabled ()) {
212- logger .trace ("No @JmsListener annotations found on bean class : " + bean .getClass ());
212+ logger .trace ("No @JmsListener annotations found on bean type : " + bean .getClass ());
213213 }
214214 }
215215 else {
@@ -243,7 +243,7 @@ protected void processJmsListener(JmsListener jmsListener, Method method, Object
243243 }
244244 }
245245
246- MethodJmsListenerEndpoint endpoint = new MethodJmsListenerEndpoint ();
246+ MethodJmsListenerEndpoint endpoint = createMethodJmsListenerEndpoint ();
247247 endpoint .setBean (bean );
248248 endpoint .setMethod (method );
249249 endpoint .setMessageHandlerMethodFactory (this .messageHandlerMethodFactory );
@@ -267,15 +267,26 @@ protected void processJmsListener(JmsListener jmsListener, Method method, Object
267267 factory = this .beanFactory .getBean (containerFactoryBeanName , JmsListenerContainerFactory .class );
268268 }
269269 catch (NoSuchBeanDefinitionException ex ) {
270- throw new BeanInitializationException ("Could not register jms listener endpoint on [" +
271- method + "], no " + JmsListenerContainerFactory .class .getSimpleName () + " with id '" +
272- containerFactoryBeanName + "' was found in the application context" , ex );
270+ throw new BeanInitializationException ("Could not register JMS listener endpoint on [" +
271+ method + "], no " + JmsListenerContainerFactory .class .getSimpleName () +
272+ " with id '" + containerFactoryBeanName + "' was found in the application context" , ex );
273273 }
274274 }
275275
276276 this .registrar .registerEndpoint (endpoint , factory );
277277 }
278278
279+ /**
280+ * Instantiate an empty {@link MethodJmsListenerEndpoint} for further
281+ * configuration with provided parameters in {@link #processJmsListener}.
282+ * @return a new {@code MethodJmsListenerEndpoint} or subclass thereof
283+ * @since 4.1.9
284+ * @see MethodJmsListenerEndpoint#createMessageListenerInstance()
285+ */
286+ protected MethodJmsListenerEndpoint createMethodJmsListenerEndpoint () {
287+ return new MethodJmsListenerEndpoint ();
288+ }
289+
279290 private String getEndpointId (JmsListener jmsListener ) {
280291 if (StringUtils .hasText (jmsListener .id ())) {
281292 return resolve (jmsListener .id ());
0 commit comments