Skip to content

Discover all VaadinServiceInitListener beans in QuarkusInstantiator #146

@mcollovati

Description

@mcollovati

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status

    Inbox (needs triage)

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions