vaadin / quarkus

An extension to Quarkus to support Vaadin Flow
Apache License 2.0
28 stars 3 forks source link

Having some challenge with I18NProviders and @VaadinServiceScoped #147

Open ckosmowski opened 4 months ago

ckosmowski commented 4 months ago

I was challenged with instantiating a custom I18NProviders. I used the docs found at the vaadin page and tried to use CDI to instantiate a bean. That bean however got removed by quarkus during bean removal:

https://quarkus.io/guides/cdi-reference#remove_unused_beans

so no I18NProvider was found.

I needed to use the bean at an injection point for quarkus to stop removing the bean or use @Unremovable to mark it. (Both seems missing in the docs).

In addition i had to add the @Default qualifier for the QuarkusInstatiator to pick up the bean correctly (which is also not mentioned in the docs).

I got some help from the quarkus project here:

https://github.com/quarkusio/quarkus/discussions/38726

Maybe the docs can be updated or that beans should be made @Unremovable and @Default by default?

mcollovati commented 4 months ago

Thanks for the issue. Indeed, all @VaadinServiceEnabled beans should be discovered and marked as unremovable (UnremovableBeanBuildItem).