Announcement Announcement Module
No announcement yet.
Enable/Disable application features Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Enable/Disable application features

    I have a question regarding possible implementation alternatives to the one I'm currently using.

    The requirement: to be able to turn on/off particular features of an application at run time.

    Right now, we have a class that we call "applicationProperties" with a bunch of different properties (isFeatureXEnabled, isFeatureYEnabled, etc, etc) which the application code (and UI code in some cases) is using to determine whether or not to turn on/off a particular feature. What's nice is that we can export the "applicationProperties" file as an MBean and change/update its values at run time through the JMX console.

    My question:
    At the moment, our application code is riddled with awful if/else statements specifying whether a particular feature should be enabled.

    .. do something...

    other parts of the app:

    .. do something..


    Has anyone else run into a requirement such as this (ability to turn on/off features at run-time) without polluting and littering their code base with if/else statements?

    Thanks in advance for any input!

  • #2
    It depends

    It depends what you mean by turning a feature off. If you mean that when accessing it a user gets a security exception then maybe spring-security method interception. If you mean that a feature is no longer accessible in the first place ...