Spring boot application.json properties example
In this article, we will show you how to use JSON instead of the properties file or the yml file in Spring Boot by custom configuration. Before moving to the example first you must be familiar with the following components. 1.spring.factories file The file is located in src/java/resources/META-INF/spring.factories . The spring.factories file is a file that spring automatically loads when booting up. It contains references to many configuration classes. For example, org.springframework.boot.env. PropertySourceLoader =com.example.demo. JsonPropertySourceLoader Here we registered our custom Json property source loader 2. YamlPropertySourceLoader Load the resource into one or more property sources. Implementations may either return a list containing a single source or in the case of a multi-document format such as YAML a source for each document in the resource. Refer import org.springframework.boot.env. YamlPropertySourceLoader ; public class JsonPropertySourceLoader ...