In this PR, we add a FeatureToggleService that can be autowired into any Java class in the application.
Feature Toggles are generally used to selectively enable features in an app while they are being incrementally developed. The usual practice is to have the toggle "false" (or "off") in production, and "true" (or "on") in development. That allows you to put feature into your app that are perhaps still only "half way done", and incrementally introduce them into the code base.
To use this service:
Add your new feature flag into application.properties with a value of false. The naming convention is app.feature.your_feature_name_here
Add an instance variable for your new feature flag into src/main/java/edu/ucsb/cs56/ucsb_courses_search/service/FeatureToggleService.java and add a getter for it.
If you need access to the value in Thymeleaf code as well, add code for it into src/main/java/edu/ucsb/cs56/ucsb_courses_search/controller/advice/FeatureToggleControllerAdvice.java
Example use in Java Code:
@Autowired
FeatureToggleService fts;
public static void example() {
if (fts.getMultipleSchedules()) {
// do something
}
}
In this PR, we add a FeatureToggleService that can be autowired into any Java class in the application.
Feature Toggles are generally used to selectively enable features in an app while they are being incrementally developed. The usual practice is to have the toggle "false" (or "off") in production, and "true" (or "on") in development. That allows you to put feature into your app that are perhaps still only "half way done", and incrementally introduce them into the code base.
To use this service:
application.properties
with a value of false. The naming convention isapp.feature.your_feature_name_here
src/main/java/edu/ucsb/cs56/ucsb_courses_search/service/FeatureToggleService.java
and add a getter for it.src/main/java/edu/ucsb/cs56/ucsb_courses_search/controller/advice/FeatureToggleControllerAdvice.java
Example use in Java Code:
Example use in Thymeleaf: