Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Features endpoint does not show disabled named feature #640

Open
kzwang opened this issue Nov 20, 2019 · 6 comments
Open

Features endpoint does not show disabled named feature #640

kzwang opened this issue Nov 20, 2019 · 6 comments

Comments

@kzwang
Copy link

kzwang commented Nov 20, 2019

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...)

@spencergibb
Copy link
Member

the named feature doesn't match to a bean so there is nothing to check.

@kzwang
Copy link
Author

kzwang commented Jan 14, 2020

@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.

@spencergibb
Copy link
Member

They should be in a single class that is conditional on property or share the same conditional

@kzwang
Copy link
Author

kzwang commented Jan 14, 2020

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.

@spencergibb
Copy link
Member

I can't think of a way to do it with named features.

@kzwang
Copy link
Author

kzwang commented Jan 14, 2020

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants