Can my module extend another module's configuration?


There are 3 ways a module can change the configuration of another module before it gets started:

  1. Your module can provide a @ModuleConfiguration class in its extension packages. A @ModuleConfiguration is like a regular @Configuration which will be added to the target module instead of the module that declares it.  See the reference documentation on @ModuleConfiguration for more information.
  2. Your module descriptor can implement the prepareForBootstrap() method, which also allows registering additional configuration classes on other modules.
  3. Your module can subscribe to the AcrossModuleBeforeBootstrapEvent and modify the module configuration at that point. Please note this requires your own module to have been started. You will only receive this event for modules that start after your own.

An example of the practical use of module configuration extensions can be found in the AcrossHibernateJpaModule. Additional entities to scan are defined through module extensions.