Top Description Methods
org.springframework.beans.factory.annotation

public @Interface Value

extends Annotation
Annotations
@Target:FIELD, METHOD, PARAMETER, ANNOTATION_TYPE
@Retention:RUNTIME
@Documented
Imports
java.lang.annotation.Documented, .ElementType, .Retention, .RetentionPolicy, .Target

Annotation used at the field or method/constructor parameter level that indicates a default value expression for the annotated element.

Typically used for expression-driven or property-driven dependency injection. Also supported for dynamic resolution of handler method arguments — for example, in Spring MVC.

A common use case is to inject values using #{systemProperties.myProp} style SpEL (Spring Expression Language) expressions. Alternatively, values may be injected using ${my.app.myProp} style property placeholders.

Note that actual processing of the @Value annotation is performed by a BeanPostProcessor which in turn means that you cannot use @Value within BeanPostProcessor or 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
AutowiredAnnotationBeanPostProcessor, Autowired, org.springframework.beans.factory.config.BeanExpressionResolver, org.springframework.beans.factory.support.AutowireCandidateResolver#getSuggestedValue

Method Summary

Modifier and TypeMethod and Description
public String
value()

The actual value expression such as #{systemProperties.myProp} or property placeholder such as ${my.app.myProp}.

Inherited from java.lang.annotation.Annotation:
annotationTypeequalshashCodetoString

Method Detail

valueback to summary
public String value()

The actual value expression such as #{systemProperties.myProp} or property placeholder such as ${my.app.myProp}.