Albin
Albin

Reputation: 2069

How to Enable/Disable specific rest end point in spring boot?

I have tried to using @ConditionalOnProperty for disable/enable the spring boot endpoint, but its not working as expected. I want to disable/enable specific end points based on conditional values not the entire controller.

Upvotes: 4

Views: 5423

Answers (1)

jordiburgos
jordiburgos

Reputation: 6302

Extract those methods to a new Controller. Then add the @ConditionalOnProperty to that Controller.

@ConditionalOnProperty works for @Bean, @Controller, @Service, ... objects, not for methods.

Upvotes: 11

Related Questions