Auto configuration

This chapter contains additional information for the auto configuration of NILS4Spring.

Add to your project

To use auto configuration in your project yo must add at least the following dependency:

Maven

<dependency>
  <groupId>com.codepulsar.nils</groupId>
  <artifactId>nils4spring-spring-boot</artifactId>
  <version>1.1.0</version>
</dependency>

Gradle

implementation group: 'com.codepulsar.nils', name: 'nils4spring-spring-boot', version: '1.1.0'
If you use nils4spring-spring-boot-starter than you must not add the dependency as it is provided by the spring boot starter.

Different configuration

There are different types of auto configuration that are enabled if some classes are found on the classpath.

SnakeYaml Adapter

The SnakeYaml Adapter auto configuration is active if you use the nils4spring-spring-boot-starter (See here for more informationu).

The auto configuration process will check:

  1. Is there a file named translation.yml on the classpath.

  2. Is the value of the configuration property nils.base-file-name configured that ends with .yml or .yaml.

Jackson Adapter

To activate the Jackson Adapter you must add its dependency (See NILS documentation - Jackson Adapter for the neccessary dependencies).

  1. Is there a file named translation.yml on the classpath.

  2. Is there a file named translation.json on the classpath.

  3. Is the value of the configuration property nils.base-file-name configured that ends with .json, .yml or .yaml.

Gson Adapter

To activate the Gson-Adapter you must add its dependency (See NILS documentation - Gson Adapter for the neccessary dependencies).

  1. Is there a file named translation.json on the classpath.

  2. Is the value of the configuration property nils.base-file-name configured that ends with .json.

JDBC Adapter

To activate the JDBC-Adapter you must add its dependency (See NILS documentation - JDBC Adapter for the neccessary dependencies).

  1. Are values of the configuration properties nils.url, nils.username and nils.password configured.

ResourceBundle Adapter

The ResourceBundle Adapter is part of nils-core and already on the classpath if you use NILS.

  1. Is there a file named translation.properties on the classpath.

  2. Is the value of the configuration property nils.base-file-name configured that ends with .properties.