Features endpoint does not show disabled named feature
For abstract feature, it checks whether there is a bean for that type or not, however, for named feature, it always adds to enabled features, instead of adding to disabled feature when there is no bean of the specified type (due to @ConditionalOn...)
the named feature doesn't match to a bean so there is nothing to check.
@spencergibb here is the use case example I'm thinking of:
@Bean
@ConditionalOnProperty("test.enabled"...)
public TestBean testBean() {
return new TestBean();
}
@Bean
public HasFeatures testFeature() {
return HasFeatures.namedFeatures(
new NamedFeature("Feature 1", TestBean.class));
}
Then the features endpoint would return "Feature 1" in disabled features if test.enabled=false, currently, it doesn't display "Feature 1" at all.
Let me know if this is not the intended use case of features endpoint.
They should be in a single class that is conditional on property or share the same conditional
They should be in a single class that is conditional on property or share the same conditional
Sorry, my previous comment was wrong. If they share the same conditional, then when that's disabled, "Feature 1" won't be displayed as "disabled" as there is no bean for the named feature as well. If not share the same conditional, then "Feature 1" is always in the enabled list.
I'd like to get the list of all enabled and disabled features in that endpoint. Currently, for named features, it can only exist in the enabled list or not in the features endpoint at all, it will never exist in the disabled list.
I can't think of a way to do it with named features.
Here is what I'm thinking:
- HasFeatures beans will never be conditional
- NamedFeatures contains the bean type or bean name (and maybe multiple bean types/names)
- Features endpoint will check for bean type/named, and if bean exists, add to the enabled list, otherwise add to the disabled list
cc @twicksell any thoughts?