Created
July 1, 2014 16:21
-
-
Save hlassiege/b1bc3810e2ac3fd7d8a4 to your computer and use it in GitHub Desktop.
Conditional
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HopSearchEnabledCondition implements Condition { | |
@Override | |
public boolean matches(ConditionContext conditionContext, AnnotatedTypeMetadata annotatedTypeMetadata) { | |
PropertyResolver resolver = conditionContext.getEnvironment(); | |
// renvoie toujours null, les propriétés ne sont jamais résolus | |
return "true".equalsIgnoreCase(resolver.getProperty("hopsearch.enabled")); | |
} | |
} | |
@Service | |
@Conditional(HopSearchDisabledCondition.class) | |
public class MockHopSearch { | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment