In short, split the boot into two phases:
- The first phase will examine the ORM Metadata, the annotation mapping and programmatic mapping, and will build a "partial" state of Hibernate Search.
- The second phase will allocate resources necessary for runtime: thread pools, file descriptors, ...
This will allow to play nice with Quarkus' "compile-time boot" feature:
- The first phase is performed during the compile-time boot, so it has access to reflection but cannot create thread pools or file descriptors
- The second phase is performed when a native image is launched, so it can create thread pools or file descriptors, but cannot use reflection (or at least not easily)