When using application.properties in Spring Boot in order to store certain parameters, we need a way to access them in our application. In this post, I will show you how to extract those values programatically.

We use a data annotation and place it on top of a class property like so:

@Value("${nameOfProperty}") //nameOfProperty in the application.properties file
private dataType nameOfVariable

If we have a method that needs to use a value in the application.properties file, we place @PostConstruct above the method.