@Repeatable
@RabbitListener
从版本 1.6 开始,@RabbitListener
注解标有 @Repeatable
。这意味着该注解可以在同一个注解元素(方法或类)上多次出现。在这种情况下,会为每个注解创建一个单独的侦听器容器,每个容器都会调用同一个侦听器`@Bean`。Repeatable 注解可与 Java 8 或更高版本一起使用。
Starting with version 1.6, the @RabbitListener
annotation is marked with @Repeatable
.
This means that the annotation can appear on the same annotated element (method or class) multiple times.
In this case, a separate listener container is created for each annotation, each of which invokes the same listener
@Bean
.
Repeatable annotations can be used with Java 8 or above.