Spring @Value annotation in @Controller class not evaluating to value inside properties file

It seems that the question has been already asked Spring 3.0.5 doesn’t evaluate @Value annotation from properties

The difference between web app root and servlet application contexts is one of the top sources of confusion in Spring, see Difference between applicationContext.xml and spring-servlet.xml in Spring Framework

From @Value javadoc :

Note that actual processing of the @Value annotation is performed by a
BeanPostProcessor

From Spring documentation:

BeanPostProcessor interfaces are scoped per-container. This is only relevant if you are using container hierarchies. If you define a BeanPostProcessor in one container, it will only do its work on the beans in that container. Beans that are defined in one container are not post-processed by a BeanPostProcessor in another container, even if both containers are part of the same hierarchy.

Leave a Comment