Is the @EnableReactiveMethodSecurity annotation capable of being dynamically enabled and disabled by reading parameters from a configuration file?
For instance: @EnableReactiveMethodSecurity(enable = "${spring.security.enableReactiveMethodSecurity}")
Configured in the application.yml as follows:
spring:
security:
enableReactiveMethodSecurity: true
This way, it's possible to flexibly choose between enabling or disabling it under different profiles, without the need to create multiple Config Classes and adding @Profile to each class for differentiation.
Comment From: marcusdacoregio
Hi, @qq253498229. It is not possible to enable/disable method security using a property. However, a better alternative would be to use ConditionalOnProperty or any other Conditional* annotation to create configurations that only apply if the property has the expected value.