Package io.micronaut.http.annotation
Annotation Interface Produces
An annotation to indicate the MediaType
s produced by a particular component.
Generally with controllers one can use the produces
attribute of the Controller
annotation,
however this annotation is more generic and applies to any component
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Optional Element Summary
-
Element Details
-
value
String[] value- Returns:
- The
MediaType
values that this component is able to produce
- Default:
- {"application/json"}
-
single
In the case of reactive types this member indicates whether only a single result is returned. Normally this annotation is unnecessary unless the declared type doesn't indicate how many items are emitted.
For JSON with single = false if an Reactive streams Publisher type is returned these will be automatically wrapped in an Array type to ensure valid JSON is returned.
If single = true it is expected that only a single result will be emitted and the result will not be wrapped in a JSON array.
- Returns:
- True if only a single result is emitted
- Default:
- false
-