I need to disable methods inside one controller via configs.
For example, we have two methods inside controller:
@PostMapping("hello")
public String helloFunc(@RequestBody List<String> numbers) {
// code
}
@PostMapping("bye")
public String byeFunc(@RequestBody List<String> anotherNumbers) {
// code
}
And we have application.yml
:
controller:
hello.enabled: true
bye.enabled: false
So, is it possible to make it so that after these settings, one method works and the other does not? (helloFunc -> work, byeFunc -> does not work).
I tried to use an annotation @ConditionalOnProperty
, but it didn't help. The function worked out anyway and responsed status 200.
Thank you