Annotation Type RestInject
Used on methods of Rest
-annotated classes to denote methods and fields that override and customize beans
used by the REST framework.
Example
The name()
/value()
attributes are used to differentiate between named beans.
Example
The methodScope()
attribute is used to define beans in the scope of specific RestOp
-annotated methods.
Example
This annotation can also be used to inject arbitrary beans into the bean store which allows them to be
passed as resolved parameters on RestOp
-annotated methods.
Example
This annotation can also be used on uninitialized fields. When fields are uninitialized, they will be set during initialization based on beans found in the bean store.
Example
Notes:
- Methods and fields can be static or non-static.
- Any injectable beans (including spring beans) can be passed as arguments into methods.
- Bean names are required when multiple beans of the same type exist in the bean store.
- By default, the injected bean scope is class-level (applies to the entire class). The
methodScope()
annotation can be used to apply to method-level only (when applicable).
Any of the following types can be customized via injection:
-
Optional Element Summary
-
Element Details
-
name
The bean name to use to distinguish beans of the same type for different purposes.For example, there are two
HeaderList
beans:"defaultRequestHeaders" and"defaultResponseHeaders" . This annotation would be used to differentiate between them.- Returns:
- The bean name to use to distinguish beans of the same type for different purposes, or blank if bean type is unique.
- Default:
- ""
-
value
Same asname()
.- Returns:
- The bean name to use to distinguish beans of the same type for different purposes, or blank if bean type is unique.
- Default:
- ""
-
methodScope
The short names of the methods that this annotation applies to.Can use
"*" to apply to all methods.Ignored for class-level scope.
- Returns:
- The short names of the methods that this annotation applies to, or empty if class-scope.
- Default:
- {}
-