一、SpringMVC框架搭建请参照,SpringMVC框架搭建
二、SpringMVC整合RabbitMQ
-
添加RabbitMQ的jar包,在pom.xml中添加:
<dependency> <groupId>org.springframework.amqp</groupId> <artifactId>spring-rabbit</artifactId> <version>2.1.2.RELEASE</version> </dependency>
-
在
src/main/resource
新建rabbit.properties,配置内容如下:# rabbit ip rabbit.host=127.0.0.1 # rabbit 端口 rabbit.port=5672 # rabbit 用户名 rabbit.username=admin # rabbit 密码 rabbit.password=admin
-
在
src/main/resource
下新建spring-rabbit-send.xml
,内容如下:<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rabbit="http://www.springframework.org/schema/rabbit" xmlns:context="http://www.springframework.org/