How to access a value defined in the application.properties file in Spring Boot

You can use the @Value annotation and access the property in whichever Spring bean you’re using

@Value("${userBucket.path}")
private String userBucketPath;

The Externalized Configuration section of the Spring Boot docs, explains all the details that you might need.

Leave a Comment