> ## Documentation Index
> Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration reference

> Complete reference for all Atoti What-If configuration properties.

## Overview

Atoti What-If configuration is managed through properties with the `atoti.what-if` prefix. These properties can be set in `application.yml` or `application.properties`.

## Property reference

### General properties

| Property | Type | Default | Description |
| - | - | - | - |
| `atoti.what-if.enable` | `boolean` | `true` | Global toggle for all What-If features. Set to `false` to disable all What-If auto-configuration. |

### Security properties

| Property | Type | Default | Description |
| - | - | - | - |
| `atoti.what-if.security.type` | `NONE`, `SPRING`, `CUSTOM` | `SPRING` | The type of security manager to use. |
| `atoti.what-if.security.use-branch-permissions` | `boolean` | `true` | Whether to use branch-level permissions. |

#### Security type options

| Value | Description |
| - | - |
| `SPRING` | Uses Spring Security context for user authentication and authorization. |
| `NONE` | No security checks are performed. All operations are allowed for all users. |
| `CUSTOM` | Provide your own `IDatabaseSimulationsSecurityManager` bean. |

### Distribution properties

| Property | Type | Default | Description |
| - | - | - | - |
| `atoti.what-if.distribution.enabled` | `boolean` | `false` | Whether the application runs in distributed mode. |
| `atoti.what-if.distribution.query-node-name` | `String` | `""` | The name of the query node. Required when distribution is enabled. |
| `atoti.what-if.distribution.create-distributed-service` | `boolean` | `true` | Whether to create the `RestDistributedDatabaseService` automatically. |

## Configuration examples

### Default configuration

No configuration is required for a standalone application with Spring Security:

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
# All defaults are applied automatically
```

### Disable security

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  what-if:
    security:
      type: none
```

### Disable branch permissions

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  what-if:
    security:
      type: spring
      use-branch-permissions: false
```

### Distributed mode

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  what-if:
    distribution:
      enabled: true
      query-node-name: "MyQueryNodeName"
```

### Full configuration example

```yaml theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
atoti:
  what-if:
    enable: true
    security:
      type: spring
      use-branch-permissions: true
    distribution:
      enabled: false
      query-node-name: ""
      create-distributed-service: true
```

## Required beans

The Spring Boot Starter requires two beans from your application:

### IDatabaseService

Provided by your Atoti Server application. This bean is used by the simulation engine to execute database operations.

When distribution is enabled, a `RestDistributedDatabaseService` is automatically created to handle communication with data nodes. Set `atoti.what-if.distribution.create-distributed-service` to `false` if you want to provide your own distributed database service implementation.

### IWhatIfPersistenceProperties

Provides Hibernate configuration for simulation persistence. The bean must return a `Map<String, String>` of Hibernate properties.

```java theme={"languages":{"custom":["/engine/python-sdk/6.2/languages/pycon.tmLanguage.json"]}}
@Bean
public IWhatIfPersistenceProperties whatIfPersistenceProperties(
        @Value("classpath:hibernate.properties") Resource resource) throws IOException {
    Properties props = new Properties();
    props.load(resource.getInputStream());
    return () -> props.entrySet().stream()
        .collect(Collectors.toMap(
            e -> String.valueOf(e.getKey()),
            e -> String.valueOf(e.getValue())
        ));
}
```

The starter uses these properties to create a `SessionFactory` bean (named `whatIfSessionFactory`). If you need more control over `SessionFactory` configuration (such as adding interceptors or event listeners), you can override the `whatIfSessionFactory` bean directly. See [How to customize auto-configured beans](https://docs.activeviam.com/solutions/libraries/what-if/5.0/dev/dev-getting-started/customize-beans.md#custom-sessionfactory) for details.

## Full generated reference

The table below is generated from the `@ConfigurationProperties` Java sources at build time, so it is always in sync with the code. Use it as the authoritative reference when the curated tables above don't cover a property.
