-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Allow disabling beans / packages via configuration #7169
Comments
Currently those creating libraries have the assumption that a given bean will exist and allowing users to disable beans will cause issues that they cannot resolve. I think if a bean is designed to be disabled then it should be done via the mechanism the library author or we intend. It should also be possible to make it so a bean cannot be disabled. This relates to the
|
some valid points. I think the specific scenario this problem is trying to solve is that you want to disable say the datasources for your tests. In that case it is not possible to remove the |
I don’t like the idea of disabling beans that aren't supposed to be disabled and might not be visible at all. I would prefer to implement disabling of any conf that implements Toggleable like data source. |
@graemerocher I think for the datasource case we should just allow them to be disabled via config
|
Hi everyone, i just faced this need. In my application i use only custom authentication fetchers. Micronaut security provides a If i could disable that bean in a configuration or code way it would be very nice, regardless the option to add a This functionality would never replace the As an alternative, which may be more suitable as it would not be customizeable by app properties though by env, i would suggest some annotation like |
There are many situations in which a user may simply want to disable some beans in certain scenarios.
For the modules that we have built, we often make the configuration properties classes to implement
Toggleable
so that they can be enabled/disabled via configuration. In other places (such as other beans, orpackage-info.java
) we use@Requires
to make those beans conditional to the presence of some enabled configuration property, e.g.:@Requires(property="some.configuration.enabled", value="true", defaultValue="true")
.Unfortunately, not all configuration properties or bean definitions have those built-in requirements. Therefore, it would be great if there could be a global way to enable/disable beans or packages via configuration.
Proposal:
The text was updated successfully, but these errors were encountered: