Created
April 8, 2018 16:42
-
-
Save nattaphonjeamjit/653130f23fe22845b2878f371eb0b1aa to your computer and use it in GitHub Desktop.
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
@Aspect | |
@Component | |
public class FeaturesAspect { | |
private static final Logger LOG = Logger.getLogger(FeaturesAspect.class); | |
@Around(value = "@within(featureSwitch) || @annotation(featureSwitch)") | |
public Object checkAspect(ProceedingJoinPoint joinPoint, FeatureSwitch featureSwitch) throws Throwable { | |
if (featureSwitch.value().isActive()) { | |
LOG.info("Feature " + featureSwitch.value().name() + " is Open"); | |
return joinPoint.proceed(); | |
} else { | |
LOG.info("Feature " + featureSwitch.value().name() + " is Close"); | |
return null; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment