vaadin / quarkus

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

Discover all VaadinServiceInitListener beans in QuarkusInstantiator #146

Open mcollovati opened 4 months ago

mcollovati commented 4 months ago

QuarkusInstantiator collects VaadinServiceInitListener by:

However, beans implementing VaadinServiceInitListener are not considered. Currently, this could be an issue in @QuarkusTest, if you, for example, want to use a custom QuarkusTestProfile to define a bean that does some initialization stuff, but for a couple of tests. If you define a class with an @Observes method, it will be invoked for all tests.

There are workaround (e.g. use @IfBuildProfile annotation on the observer class, or define the method as @Observes(notifyObserver = Reception.IF_EXISTS) and inject the bean into the test class to force the creation), but it would be easier if QuarkusInstantiator also collects all beans implementing VaadinServiceInitListener so that a developer could simply define the bean in the test profile.

Probably should only load VaadinServiceInitListener beans having the @VaadinServiceEnabled qualifier