Spring boot,多个@EventListener(ApplicationReadyEvent.class)时如何指定顺序

Edu*_*rdo 4 operator-precedence spring-boot

我有一个在应用程序启动后运行的类,它有注释:

@EventListener(ApplicationReadyEvent.class)

没关系,问题是在我的项目中有一个具有相同注释的库(依赖项),它在我的项目之后运行,我需要指定顺序/优先级,以便依赖项中的代码在我的项目之前执行。

小智 7

您可以使用@Order(value=x)

其中 x = 所需的订单值