Description
One of the top reason to create an extension is to control bean inclusion / removal to the bean factory. This can be complex if we want to use an external library not covered by Quarkus.
We can already control easily bean inclusion in multiple ways (see the CDI guide) but to control bean removal we only have @Unremovable.
It should be possible to setup some bean unremovable directive from application.properties.
Some background discussion can be found on this Zulip thread: https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/Allowing.20applications.20to.20contribute.20build.20time.20code
Implementation ideas
Offer some configuration properties to control the removal of beans.
For example:
quarkus.arc.unremovable.types: list of unremovable types.quarkus.arc.unremovable.packages: list of packages wich contains unremovable types.quarkus.arc.unremovable.annotations: list of annotations which annotated beans must be unremovable.quarkus.arc.unremovable.hierarchies: list of interfaces or classes which are parents to beans that must be unremovable.I'm not so sure about the annotations and hierarchies but it probably makes sense to introduce a config property that would allow users to mark types as unremovable. I would start with the quarkus.arc.unremovable-types property that would follow the syntax we use for quarkus.arc.selected-alternatives and quarkus.arc.exclude-types, i.e. org.acme.Foo, org.acme.*, org.acme.**, etc.
We should also clarify that all beans discovered from the matching type will be unremovable, including all producers declared on that type.
OK, this is a good starts anyway ;)
I'll send a PR for this sometimes next week.
IMPL NOTE: Take a look at ArcProcessor.initClassPredicates(List<String>) (BTW we should rename the param selectedAlternatives -> types or something like that).
Most helpful comment
I'll send a PR for this sometimes next week.