Announcement Announcement Module
Collapse
No announcement yet.
Enable/Disable application features Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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.
    E.G.:

    if(isFeatureXEnabled()){
    .. do something...
    }

    other parts of the app:

    if(isFeatureYEnabled()){
    .. do something..
    }

    etc...

    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 ...

    Comment

    Working...
    X