springAOP编程整合rabbitmq
2021-06-20 02:05
标签:npoi 成功 join 模板 通知 com exe wing key @Component } springAOP的配置 springAOP编程整合rabbitmq 标签:npoi 成功 join 模板 通知 com exe wing key 原文地址:http://blog.51cto.com/12165865/2178963
public class AopAspect {@Autowired
private AmqpTemplate template1;
public void beforeAdvice(JoinPoint joinPoint) {
String s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
template1.convertAndSend("defaultQueue",s);
System.out.println("向消息队列发送消息" + s);
}
public void afterAdvice(JoinPoint joinPoint){
Object o = template1.receiveAndConvert("defaultQueue");
System.out.println("向队列消费消息" + o.toString());
}