My modules are bootstrapped in the wrong order.

The order in which modules are started is determined by the dependencies they have on each other. If module B depends on module A, then module A will be started before module B. If modules are started in the wrong order, this means their dependencies are not clearly defined.

There is a difference between a required and an optional dependency, however. If a dependency is required, the order is guaranteed and the application will not start if any form of cyclic dependency occurs. If a dependency is optional, the order is not guaranteed and cyclic dependencies are technically possible (but should still be avoided).

As a last resort you can define runtime dependencies on your module. This can only be done by declaring your module as a bean and setting the runtime dependencies property.