KeycloakSessionFactory slowly initializing

I am developing a Keycloak Based application which is embedded inside of a Spring Boot project. More specifically, I have made a setup based on the approach described here: Keycloak Embedded in a Spring Boot Application | Baeldung. I am using the default static method KeycloakApplication.getSessionFactory() in order to obtain a KeycloakSessionFactory that can be used to instantiate a KeycloakSession. However, the default KeycloakSessionFactory seems to be instantiated some time after the application is started, making it difficult to inject the factory as a Spring Bean as well as to use it in (unit) test scenarios. I would like either to construct the factory myself manually, or to have a way of making sure that I know when it is available for me to use. I have tried to use both the Lazy and DependsOn annotations, and I am now all out of ideas.