You can use the @Value
to load variables from the application.properties
if you will use this value in one place, but if you need a more centralized way to load this variables @ConfigurationProperties
is a better approach.
Additionally you can load variables and cast it automatically if you need different data types to perform your validations and business logic.
application.properties
custom-app.enable-mocks = false
@Value("${custom-app.enable-mocks}")
private boolean enableMocks;