@Retention(value=RUNTIME) @Target(value={TYPE,METHOD}) @Documented public @interface FeaturesAreActive
Controller
or a controller method to only activate it when
all the features given in the features()
attribute of the given featureClass()
are active.
If the features are not activated, a response with the status code given by the responseStatus()
attribute is generated (404 by default).
The Feature
implementation given in the featureClass()
attribute needs to be an enum.
@Controller @RequestMapping("/new-feature") @FeaturesAreActive(featureClass=MyFeatures.class, features="NEW_FEATURE") public class MyNewFeature { @RequestMapping(method = RequestMethod.GET) public String newFeature() { return ....; } @FeaturesAreActive(featureClass=MyFeatures.class, features="NEW_SECURE_FEATURE", responseStatus=403) @RequestMapping(value="/secure", method = RequestMethod.GET) public String newSecureFeature() { return ....; } }The
FeatureInterceptor
needs to be registered in Spring MVC for this to work. This is automatically
done by the TogglzAutoConfiguration config which is loaded if @EnableAutoConfiguration
is used in your project.Modifier and Type | Required Element and Description |
---|---|
Class<? extends org.togglz.core.Feature> |
featureClass |
String[] |
features |
Modifier and Type | Optional Element and Description |
---|---|
int |
responseStatus |
Copyright © 2017. All Rights Reserved.