Tuesday, December 6, 2011

Cached Property File Enum

We had a little need to dynamically enable and disable features on our current project and I sorta left it for the last day, came up with a simple little solution that ended up quite neat.

A cached property file enum:


 How it looks being used:
Code:
Test:
The .properties file:
FEATUREA=true
FEATUREB=false
FEATUREC=true

How it works:

3 comments:

  1. Simple and elegant solution. Thanks for sharing!

    ReplyDelete
  2. Here's a challenge for you:

    Inject one of these reloaded properties into a spring application context... that's a mystery that I've tried to solve before with varying success (bob, bob, bob, bob etc).

    ReplyDelete
  3. Ok challenge accepted :) check my post:

    Spring 3: Scheduling, Components, PostBeanProcessors and bending the rules.
    (June last year)

    ReplyDelete

Popular Posts

Followers