/*
 * Copyright 2013 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.
 * 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.boot.sample.amqp;

import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
import org.springframework.amqp.rabbit.listener.adapter.MessageListenerAdapter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor;

@Configuration
@EnableAutoConfiguration
@ComponentScan
public class SampleAmqpSimpleApplication {

	@Autowired
	private RabbitTemplate rabbitTemplate;
	
	@Autowired
	private ConnectionFactory connectionFactory;

	@Bean
	public ScheduledAnnotationBeanPostProcessor scheduledAnnotationBeanPostProcessor() {
		return new ScheduledAnnotationBeanPostProcessor();
	}

	@Bean
	public Sender mySender() {
		return new Sender();
	}

	@Bean
	public SimpleMessageListenerContainer container() {
		SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
		Object listener = new Object() {
			public void handleMessage(String foo) {
				System.out.println(foo);
			}
		};
		MessageListenerAdapter adapter = new MessageListenerAdapter(listener);
		container.setMessageListener(adapter);
		container.setQueueNames("foo");
		return container;
	}


	public static void main(String[] args) throws Exception {
		SpringApplication.run(SampleAmqpSimpleApplication.class, args);
	}
}

@@ -693,43 +693,25 @@
 mqp.
-rabbit.connection.ConnectionFactory
+core.AmqpTemplate
 ;%0Aim
@@ -753,25 +753,34 @@
 t.co
-re.RabbitTemplate
+nnection.ConnectionFactory
 ;%0Aim
@@ -1178,69 +1178,8 @@
 an;%0A
-import org.springframework.context.annotation.ComponentScan;%0A
 impo
@@ -1367,23 +1367,8 @@
 ion%0A
-@ComponentScan%0A
 publ
@@ -1432,14 +1432,12 @@
 ate 
-Rabbit
+Amqp
 Temp
@@ -1441,22 +1441,20 @@
 emplate 
-rabbit
+amqp
 Template
@@ -1888,16 +1888,16 @@
 ctory);%0A
-
 %09%09Object
@@ -1923,16 +1923,47 @@
 ect() %7B%0A
+%09%09%09@SuppressWarnings(%22unused%22)%0A
 %09%09%09publi

Tweak AMQP sample slightly