如下是生产者的示例代码:
启动报错如下:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
报错的意思是:未加载到StaticLoggerBinder这个类
查找报错原因:我在创建项目的时候只添加了rabbitmq的依赖,没有添加slf4j的依赖
解决方法:添加slf4j的依赖就行
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.32</version>
</dependency>
搞定,再见!