Skip to content

OmarAssadi/spring-toml-property-source

Repository files navigation

中文版请阅此处

Spring TOML Property Source

Spring TOML Property Source adds support loading TOML-based configuration files in your Spring Boot applications.

This project is divided up into two parts:

Usage

  1. Add the library as a dependency. You can find it in the Maven Central repository. For gradle users, simply add the following:
implementation 'com.omarassadi:spring-toml-property-source:1.0.0'
  1. Register the property source loader with Spring. You can do this by creating a file in the META-INF/ directory called spring.factories and adding the following line:
org.springframework.boot.env.PropertySourceLoader=com.omarassadi.spring.tomlpropertysource.TomlPropertySourceLoader
  1. In your resources/ directory, create file named application.toml. In that file, you can configure your Spring application as you would have using standard application.properties or application.yml files.

Alternatively, you may mark a class with the added @TomlPropertySource annotation. This works identically to the @PropertySource annotation that is bundled with Spring, except that it loads TOML rather than standard .properties files.

About

Adds support for loading TOML configurations in Spring

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages