Package io.micronaut.http.annotation
Annotation Interface Controller
@Documented
@Retention(RUNTIME)
@Target({TYPE,ANNOTATION_TYPE})
@Bean
@DefaultScope(jakarta.inject.Singleton.class)
public @interface Controller
Indicates that the role of a class is a controller within an application.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Optional Element Summary
-
Element Details
-
value
This attribute returns the base URI of the controller
A value of
/
can be used to map a controller to the root URI.- Returns:
- The base URI of the controller in the case of web applications
- Default:
- "/"
-
produces
- Returns:
- The produced MediaType values. Defaults to application/json
- Default:
- {"application/json"}
-
consumes
- Returns:
- The consumed MediaType for request bodies Defaults to application/json
- Default:
- {"application/json"}
-
port
String portAllows specifying an alternate port to run the controller on. Setting this member will cause.The member is defined as a string to allow resolving the port value from configuration. For example:
member = "${my.port.number}"
- Returns:
- The port to use.
- Default:
- ""
-