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

Discover all VaadinServiceInitListener beans in QuarkusInstantiator #146

Open
mcollovati opened this issue Feb 5, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@mcollovati
Copy link
Contributor

mcollovati commented Feb 5, 2024

QuarkusInstantiator collects VaadinServiceInitListener by:

  • delegating to the DefaultInstantiator, that uses ServiceLoader
  • registering a listener that fires a CDI ServiceInitEvent event, to engage all observer methods

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

1 participant