Annotation Interface Controller


Indicates that the role of a class is a controller within an application.

Since:
1.0
Author:
Graeme Rocher
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
     
    Allows specifying the local server port that the routes declared by the controller should match.
     
    This attribute returns the base URI of the controller
  • 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

      @AliasFor(annotation=Produces.class, member="value") String[] produces
      Returns:
      The produced MediaType values. Defaults to application/json
      Default:
      {"application/json"}
    • consumes

      @AliasFor(annotation=Consumes.class, member="value") String[] consumes
      Returns:
      The consumed MediaType for request bodies Defaults to application/json
      Default:
      {"application/json"}
    • port

      String port
      Allows specifying the local server port that the routes declared by the controller should match.

      Setting this member does not by itself create a listener on that port. Configure the server to listen on the desired port separately, for example with micronaut.server.netty.listeners.*.port.

      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:
      ""