JmsBootstrapConfiguration.java 2.1 KB
Newer Older
1
/*
2
 * Copyright 2002-2015 the original author or authors.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.springframework.jms.annotation;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Role;
23
import org.springframework.jms.config.JmsListenerConfigUtils;
24 25 26 27 28 29 30 31
import org.springframework.jms.config.JmsListenerEndpointRegistry;

/**
 * {@code @Configuration} class that registers a {@link JmsListenerAnnotationBeanPostProcessor}
 * bean capable of processing Spring's @{@link JmsListener} annotation. Also register
 * a default {@link JmsListenerEndpointRegistry}.
 *
 * <p>This configuration class is automatically imported when using the @{@link EnableJms}
J
Juergen Hoeller 已提交
32
 * annotation. See the {@link EnableJms} javadocs for complete usage details.
33 34 35 36 37 38 39 40
 *
 * @author Stephane Nicoll
 * @since 4.1
 * @see JmsListenerAnnotationBeanPostProcessor
 * @see JmsListenerEndpointRegistry
 * @see EnableJms
 */
@Configuration
41
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
42 43
public class JmsBootstrapConfiguration {

44
	@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
45 46 47 48 49
	@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
	public JmsListenerAnnotationBeanPostProcessor jmsListenerAnnotationProcessor() {
		return new JmsListenerAnnotationBeanPostProcessor();
	}

50
	@Bean(name = JmsListenerConfigUtils.JMS_LISTENER_ENDPOINT_REGISTRY_BEAN_NAME)
51 52 53 54 55
	public JmsListenerEndpointRegistry defaultJmsListenerEndpointRegistry() {
		return new JmsListenerEndpointRegistry();
	}

}