channel()报空指针
package com.hits.modules.rabbitmq;
import org.nutz.ioc.aop.Aop;
import org.nutz.ioc.loader.annotation.IocBean;
import static org.nutz.integration.rabbitmq.aop.RabbitmqMethodInterceptor.channel;
@IocBean
public class SendMqService {
@Aop("rabbitmq") // 会自动管理Connection/Channel的开启和关闭.
public void publish(String routingKey, byte[] body) throws Exception {
channel().basicPublish("", routingKey, null, body);
}
}
java.lang.NullPointerException
at com.demo.rabbitmq.SendMqService.publish(SendMqService.java:13)