Blog Archive for January 1, 2020

Reading from Properties Files in Spring Boot

January 1, 2020

I wanted to read some settings from a properties file and have it available to my Spring Boot application. This can be done in the following way:

package com.drumcoder.diary.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;

@Configuration
@PropertySource(value = …