CDI UI provider

Hi Guys,

How can I use Vaadin CDI UI (not view!) provider?

I have created my UI privder class:

public class AppUIProvider extends CDIUIProvider {

    public Class<? extends UI> getUIClass(UIClassSelectionEvent event) {
        if (event.getRequest().getHeader("user-agent").contains("Firefox")) {
            return AppUI.class;
        } else {
            return OtherUI.class;

How can I register/add/use this class?

Never tried but a quick googling suggests an init-param:

Thanks Nicklas.
I have tried to annotate the my VaadinCDIServlet class with @WebInitParam:

@WebInitParam(description = "Vaadin UI Provider", name = "UIProvider", value = "com.myproject.fw.ui.AppUIProvider") But it seems, doesn’t work. Nothing happend. :frowning:

Hmm. If nothing else helps, you might have to look at the source and how it’s used, e.g.

The CDI extension itself appeared to deal mostly with Views

The CDIUIProvider is probably not available as a managed bean so @Specialize:ing it will probably not work

At the moment, CDIUIProvider is hard coded in
. You could create an enhancement request at
for making it easier to customize.