Annotation Type 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
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String[] consumes  
      java.lang.String port
      Allows specifying an alternate port to run the controller on.
      java.lang.String[] produces  
      java.lang.String value
      This attribute returns the base URI of the controller
    • Element Detail

      • value

        @AliasFor(annotation=UriMapping.class,
                  member="value")
        java.lang.String 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")
        java.lang.String[] produces
        Returns:
        The produced MediaType values. Defaults to application/json
        Default:
        {"application/json"}
      • consumes

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

        java.lang.String port
        Allows 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:
        ""