
# What a build contains

What a build of an application with `spring_boot_starter_data` contains, and when something is not in it. A module that follows a key reads it when `build_runner` runs, from `application.yml` or `application.properties` without a profile (see [Modules left out of the build](../spring-core-dart-generator/optimizations/build-conditions.md)). The modules of the packages it depends on come with it: for `spring_boot_dart`, see [Auto-configuration](../spring-boot-dart/auto-configuration.md).

## Always in

No `build:` and no `platform:`: in every build of an application that depends on the starter.

| Module | What it holds |
|---|---|
| `springBootStarterDataAutoConfiguration` | The SQL data sources, transaction managers and templates, the mapping context, the entity converter, the stores (the in-memory store among them), the auditing handler and the factory that builds the repositories. |

## By key

`build: AutoConfigurationBuild(key)`: `true` puts the module in every build, `false` leaves it out with all its code, and when the key is not set the *Not set* column decides.

| Module | Key | Not set | What it holds |
|---|---|---|---|
| `springBootStarterDataStartupChecksAutoConfiguration` | `spring.main.startup-checks.enabled` | debug and profile builds only | `transactionValidator` (stops the start for a `@Transactional` method that is not async or names a transaction manager that does not exist) and `dataFailureAnalyzer` (explains a database that fails the start). Without them a wrong `@Transactional` method fails at its first call. |
| `springBootStarterDataSqlLoggingAutoConfiguration` | `spring.data.jdbc.show-sql` | debug and profile builds only | `jdbcLogSettings` of `show-sql`, `format-sql` and `show-parameters`. `true` in the configuration without a profile keeps it in every build; a profile such as `dev` can still turn it on when the application runs. The slow-query log (`jdbcSlowQueryLogSettings`) stays in the main module: slow statements are logged at warn in every build. |

A module left to `notInRelease` is dropped from Flutter's release builds and from `dart compile exe`. `dart run` and `dart compile js` / `wasm` define no `dart.vm.product`, so there the module stays when the key is not set; only `false` leaves it out.

## What the generator writes for it

A part of the generator (see [Starter parts](../spring-core-dart-generator/how-it-works.md#starter-parts)) runs only when the application reaches its package.

| Part or builder | What it does |
|---|---|
| Data metadata part (`spring_boot_starter_data`) | The `entities` (the `@Table` classes with their tables, columns and relations) and the `repositories` of `spring_metadata.json`. |
| Data part (`spring_boot_starter_data`) | Describes each `@Table` class for the data layer; writes the class of each repository and its bean, the `EntityIntrospections` bean and the glue of the drivers the application lists (`sqlite3`, `postgres`); checks derived queries, `@Query` texts against the entities and the schema, and `@Transactional` against the default store; a mistake fails the build. |
| Web glue (data part) | When the application also reaches the web starter: `dataAccessExceptionResolver` (data errors answered with their HTTP status) and `pagingArgumentResolvers` (`Pageable` and `Sort` parameters). |
| Through its dependencies | The actuator part and the web part, since the starter depends on `spring_boot_actuator` and `spring_web_dart`. |

## Good to know

- The schema step (`create`, `validate`) and the in-memory store are not switchable yet: they are in every build.

## See also

- [Modules left out of the build](../spring-core-dart-generator/optimizations/build-conditions.md)
- [How the generation works: starter parts](../spring-core-dart-generator/how-it-works.md#starter-parts)
- [The builders](../spring-core-dart-generator/builders.md)
- [Logging SQL](logging.md)
- [Schema and migrations](schema.md)
- [Errors](errors.md)
