|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Retention(value=RUNTIME) @Target(value={METHOD,FIELD}) @Inherited @Documented public @interface ExternalValue
Annotation used to assign externally-supplied values to fields and/or methods. If a field has a default value, that default value will be used if no property can be found. If an ExternalValue-annotated method is non-abstract, its method body will be executed if no matching external value can be found.
@Configuration @PropertiesValueSource(locations="some.properties") public class Config { @ExternalValue("value.1") String value1; @ExternalValue("value.2") String value2; public @Bean Foo foo() { return new Foo(value1, value2); } }
@Configuration @PropertiesValueSource(locations="some.properties") public abstract class Config { abstract @ExternalValue("value.1") String value1(); abstract @ExternalValue("value.2") String value2(); public @Bean Foo foo() { return new Foo(value1(), value2()); } }
ValueResolver
,
PropertiesValueSource
,
EnvironmentValueSource
Optional Element Summary | |
---|---|
java.lang.String |
value
Indicates the property name to be looked up against any registered ValueResolver beans. |
public abstract java.lang.String value
ValueResolver
beans. If left empty,
value will default to the name of the annotated field
or method.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |