> ## 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.

# Properties in Atoti Server

The configuration properties defined and used in Atoti Server are centralized in a single accessor/setter.
These properties are now also defined and documented in a single `ActiveViamProperty.java` file.

The new mechanism for property handling in Atoti allows the usage of JVM arguments, system/environment properties, and external property files.

### Atoti Server Properties

Properties in Atoti are now defined and documented in the `ActiveViamProperty` class.
They correspond to the properties used to configure Atoti as well as other ActiveViam products.

### The `PropertyRegistry`

The `PropertyRegistry` class contains the information about resolved properties and their current values.

By default, Atoti Server provides the property handling mechanism that can use the following sources for Atoti properties :

* System properties (JVM -Dxxx arguments)
* Environment variables

We also provide the following `ActiveViamPropertyFromSpringConfig` configuration class, which allows you to use Spring-specific annotations or methods.

Properties defined in the Spring environment through property files or other means are resolved during the Bean-initializing phase **ONLY IF** the `ActiveViamPropertyFromSpringConfig` configuration class was imported in the Spring configuration.
In that case, the properties resolving order follows the Spring logic for handling properties (see [the Spring Boot documentation](https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html))

For example, you can import properties through Spring annotations :

* `@Import` annotation declares an import of a Configuration class allowing you to logically load either or both of the following:
  * beans
  * nested Configurations defined by another

* `@ContextConfiguration` annotation defines the Configurations classes to load in a Test class.
  To work properly in tests, it requires the following annotation:
  `@RunWith(SpringJUnit4ClassRunner.class)`

> Once the Registry has been instantiated, you cannot dynamically reload registry properties from the Sources.
> To programmatically change Atoti Server Properties you must use the `ActiveViamPropertyRegistry` API.

The `ActiveViamPropertyRegistry` provides several methods to handle properties :

* Type-specific accessors with default fallback value: `getString()` , `getInteger()`, `getLong()`, `getBoolean()`,`getDouble`
* Type-specific accessors with required value: `getRequiredString()` , `getRequiredInteger()`, `getRequiredLong()`, `getRequiredBoolean()`,`getRequiredDouble()`.
  When a requested property is not defined in the `PropertyRegistry` while calling these methods, an exception is thrown.
* Generic setter `set()`
* Entry deletion method`clear()`

### Resolving Properties

The properties are resolved in the following order, from the highest priority source to the lowest:

* Properties defined in the Spring Environment *(if* `ActiveViamPropertyFromSpringConfig` *class is imported)*
* System properties (-DXXX arguments)
* Environment variables
