Skip to main content
This page explains how to customize or replace the beans that the Spring Boot Starter creates automatically.

How auto-configuration works

The Spring Boot Starter uses @ConditionalOnMissingBean annotations on all auto-configured beans. This means your custom beans take precedence over the defaults. If you define a bean of the same type, the auto-configuration skips creating its version.

How to override a bean

Define a bean of the same type in your configuration class:
The starter detects your bean and skips creating the default IncrementalUniqueIdGenerator.

Common customization scenarios

Custom ID generator

The default ID generator uses an incremental counter starting from the epoch second. To use a different strategy:

Custom security manager

To implement custom authorization logic, provide your own IDatabaseSimulationsSecurityManager:
When you provide a custom security manager, set the security type to custom in your configuration:
See How are user permissions managed for details on implementing custom security managers.

Custom workflow

To modify how simulations are created, executed, or deleted:

Custom distributed database service

When running in distributed mode, you can provide a custom implementation:
Set the configuration to not create the default distributed service:

Custom SessionFactory

To customize the Hibernate SessionFactory beyond what persistence properties provide (such as adding interceptors or event listeners):
The destroyMethod = "close" attribute ensures the SessionFactory closes properly when the application shuts down. When you override the SessionFactory, the default ISimulationPersistenceManager automatically uses your custom instance.

Bean dependencies

When customizing beans, be aware of their dependencies. The auto-configuration wires beans together in this order:
  1. DatabaseSimulationEngine and IUniqueIdGenerator (no dependencies)
  2. SessionFactory (requires IWhatIfPersistenceProperties)
  3. ISimulationPersistenceManager (requires SessionFactory)
  4. IDatabaseSimulationsSecurityManager (may require persistence manager)
  5. IDatabaseSimulationsWorkflow (requires engine, persistence manager, security manager, database service, ID generator)
  6. DatabaseSimulationsRestService (requires workflow, persistence manager, database service)
If you override a bean that others depend on, ensure your implementation is compatible.

Verifying your customizations

To verify which beans are active, enable debug logging:
Or inspect the application context at runtime: