Skip to content

Commit d07be59

Browse files
committed
Improve Javadoc for @value regarding supported expressions
Closes gh-25284
1 parent 46c7861 commit d07be59

File tree

1 file changed

+12
-8
lines changed
  • spring-beans/src/main/java/org/springframework/beans/factory/annotation

1 file changed

+12
-8
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/annotation/Value.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,14 +23,17 @@
2323
import java.lang.annotation.Target;
2424

2525
/**
26-
* Annotation at the field or method/constructor parameter level
27-
* that indicates a default value expression for the affected argument.
26+
* Annotation used at the field or method/constructor parameter level
27+
* that indicates a default value expression for the annotated element.
2828
*
29-
* <p>Typically used for expression-driven dependency injection. Also supported
30-
* for dynamic resolution of handler method parameters, e.g. in Spring MVC.
29+
* <p>Typically used for expression-driven or property-driven dependency injection.
30+
* Also supported for dynamic resolution of handler method arguments &mdash; for
31+
* example, in Spring MVC.
3132
*
32-
* <p>A common use case is to assign default field values using
33-
* <code>#{systemProperties.myProp}</code> style expressions.
33+
* <p>A common use case is to inject values using
34+
* <code>#{systemProperties.myProp}</code> style SpEL (Spring Expression Language)
35+
* expressions. Alternatively, values may be injected using
36+
* <code>${my.app.myProp}</code> style property placeholders.
3437
*
3538
* <p>Note that actual processing of the {@code @Value} annotation is performed
3639
* by a {@link org.springframework.beans.factory.config.BeanPostProcessor
@@ -55,7 +58,8 @@
5558
public @interface Value {
5659

5760
/**
58-
* The actual value expression &mdash; for example, <code>#{systemProperties.myProp}</code>.
61+
* The actual value expression such as <code>#{systemProperties.myProp}</code>
62+
* or property placeholder such as <code>${my.app.myProp}</code>.
5963
*/
6064
String value();
6165

0 commit comments

Comments
 (0)