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

CDI not working in parent layouts #75

Closed
dasfuu opened this issue May 9, 2022 · 1 comment · Fixed by #85
Closed

CDI not working in parent layouts #75

dasfuu opened this issue May 9, 2022 · 1 comment · Fixed by #85
Labels

Comments

@dasfuu
Copy link

dasfuu commented May 9, 2022

Vaadin Version: 23.1.0.beta1
Quarkus Version: 2.8.2.Final

I have a view and a parent layout. I cannot @Inject in the layout class with Quarkus. But I can in a project deployed in a Wildfly Server.

@Route(value = "", layout = MyLayout.class)
public class MainView extends VerticalLayout implements AfterNavigationObserver  {

    @Inject
    Something someService; //this works

    @Override
    public void afterNavigation(AfterNavigationEvent afterNavigationEvent) {
        System.out.println(someService); //Prints null
    }

}

@Route(value = "", layout = MyLayout.class)
public class MyLayout extends AppLayout implements AfterNavigationObserver {

    @Inject
    Something someService; //this does not work

    @Override
    public void afterNavigation(AfterNavigationEvent afterNavigationEvent) {
        System.out.println(someService); //Prints class instance
    }

}
@dasfuu dasfuu changed the title CDI not working in CDI not working in parent layouts May 9, 2022
@mcollovati
Copy link
Contributor

Seems like RouterLayout implementors are not considered during bean discovery.
We should manage them in the same way we do for HasErrorParameter implementors

mcollovati added a commit that referenced this issue Sep 14, 2022
Currently RouterLayout implementations are ignored by CDI in Quarkus
This change specify RouterLayout implementors as additional bean classes
to be analyzed during bean discovery.

Fixes #75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants