Skip to content

Capability to disable a single controller method by configuration #2499

@fabfreitas

Description

@fabfreitas

Hello,

I would like to know if it is possible add the capability to disable a single controller method by configuration, like as example below:

controllers:
  mycontroller:
    hello:
       enabled: false

and...

import io.micronaut.context.annotation.Requires;
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;

@Controller("/mycontroller")
public class MyController {

    @Requires(property = "controllers.mycontroller.hello.enabled", value = "true")
    @Get("/hello")
    public String index() {
        return "Hello, World!";
    }
}

The reason is I would like to configure some api endpoints to not be reachable, while others will be.

Thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requestedwait for replyNeed more information from reporter

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions