Value(value: String)
Annotation at the field or method/constructor parameter level that indicates a default value expression for the affected argument.
Typically used for expression-driven dependency injection. Also supported for dynamic resolution of handler method parameters, e.g. in Spring MVC.
A common use case is to assign default field values using "#{systemProperties.myProp}" style expressions.
Note that actual processing of the @Value annotation is performed by a org.springframework.beans.factory.config.BeanPostProcessor which in turn means that you cannot use @Value within org.springframework.beans.factory.config.BeanPostProcessor or org.springframework.beans.factory.config.BeanFactoryPostProcessor types. Please consult the javadoc for the AutowiredAnnotationBeanPostProcessor class (which, by default, checks for the presence of this annotation).
Author
Juergen Hoeller
Since
3.0
See Also
AutowiredAnnotationBeanPostProcessorAutowiredorg.springframework.beans.factory.config.BeanExpressionResolverorg.springframework.beans.factory.support.AutowireCandidateResolver#getSuggestedValue