@Value Spring Boot

Viewed 40

I can't understand how spring boot handles annotation @Value. When I inject value to my field of class(with @Value), handler takes that value from Spring Environement or directly from application.properties/application.yaml?

1 Answers

The answer to your question (does the value come from the Environment or from the application.yaml?) is yes, the value comes from the environment or from the application.yaml file.

Here is a reasonable writeup on the @Value annotation: https://www.baeldung.com/spring-value-annotation

In the Baeldung article, SpEL stands for Spring Expression Language.

Related