Skip to content

Instantly share code, notes, and snippets.

Created September 30, 2013 05:48
Show Gist options
  • Save chkal/6759782 to your computer and use it in GitHub Desktop.
Save chkal/6759782 to your computer and use it in GitHub Desktop.
Example for a custom activation strategy that combines two existing strategies
public class UserClientIpActivationStrategy implements ActivationStrategy {
private final ActivationStrategy userStrategy = new UsernameActivationStrategy();
private final ActivationStrategy ipStrategy = new ClientIpActivationStrategy();
public String getId() {
return "user-ip";
public String getName() {
return "Username & Client IP";
public boolean isActive(FeatureState featureState, FeatureUser user) {
return userStrategy.isActive(featureState, user) &&
ipStrategy.isActive(featureState, user);
public Parameter[] getParameters() {
return new Parameter[] {
Copy link

AshishShetkar commented Nov 21, 2016

how do we do this in property file, i mean how about this

FEATURE_02.strategy=user-role,username --- this is not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment