I have a situation where one of my classes needs to perform some initialization tasks when the application starts up. This class depends on another component that also needs to be initialized at startup. I am using Quarkus and have annotated the dependent component with @Startup
to ensure it gets initialized early. However, I am observing that the initialization method in my main class, which listens for the StartupEvent
, is executing before the dependent component is initialized. This leads to issues such as the dependent component not being available when my main class tries to use it, resulting in exceptions. How can I ensure that the dependent component is fully initialized before my main class starts its initialization process in Quarkus?
In Spring I could use the @DependsOn
which does not exist in Quarkus
I tried to use the @Priority
but it seems to not work in my case.
Does anyone have an idea how I can control the initialisation sequence for those beans?