001/*
002 * Copyright 2002-2015 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *      https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016
017package org.springframework.jms.annotation;
018
019import org.springframework.beans.factory.config.BeanDefinition;
020import org.springframework.context.annotation.Bean;
021import org.springframework.context.annotation.Configuration;
022import org.springframework.context.annotation.Role;
023import org.springframework.jms.config.JmsListenerConfigUtils;
024import org.springframework.jms.config.JmsListenerEndpointRegistry;
025
026/**
027 * {@code @Configuration} class that registers a {@link JmsListenerAnnotationBeanPostProcessor}
028 * bean capable of processing Spring's @{@link JmsListener} annotation. Also register
029 * a default {@link JmsListenerEndpointRegistry}.
030 *
031 * <p>This configuration class is automatically imported when using the @{@link EnableJms}
032 * annotation. See the {@link EnableJms} javadocs for complete usage details.
033 *
034 * @author Stephane Nicoll
035 * @since 4.1
036 * @see JmsListenerAnnotationBeanPostProcessor
037 * @see JmsListenerEndpointRegistry
038 * @see EnableJms
039 */
040@Configuration
041@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
042public class JmsBootstrapConfiguration {
043
044        @Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
045        @Role(BeanDefinition.ROLE_INFRASTRUCTURE)
046        public JmsListenerAnnotationBeanPostProcessor jmsListenerAnnotationProcessor() {
047                return new JmsListenerAnnotationBeanPostProcessor();
048        }
049
050        @Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME)
051        public JmsListenerEndpointRegistry defaultJmsListenerEndpointRegistry() {
052                return new JmsListenerEndpointRegistry();
053        }
054
055}