By default there is no need for a custom widgetset as MPR will function by using the AppWidgetset that is automatically built and configured by scanning the dependencies. For more information on the AppWidgetset and widgetset compilation see Add-ons and Widget Set part of application environment.

Note
When using MPR you can not use CDN for the widgetset. This means that the configuration <vaadin.widgetset.mode>cdn</vaadin.widgetset.mode> should be removed.

Custom widgetset and MPR

To use a custom widgetset for the legacy framework embedded with MPR, just add MprWidgetset annotation to your root navigation level, RouterLayout or to the top level @Route.

The closest instance found will be used for first initialization for a UI instance, but the recommendation would be to put it always on the top most RouterLayout in the view chain.

@MprWidgetset("com.vaadin.mpr.DemoWidgetset")
public class MainLayout extends Div implements RouterLayout {
}

@Route(value = "", layout = MainLayout.class)
public class RootTarget extends Div {
    public RootTarget() {
      LegacyWrapper addressbookWrapper = new LegacyWrapper(
                  new AddressbookLayout());
      add(addressbookWrapper);
    }
}

Generally the AppWidgetset will contain widgetsets things found by scanning the dependencies, but at times you might only want to have specific widgetsets included or you have the need for an optimized widgetset with eager and lazy parts.

Note
The widgetset should start with <!-- WS Compiler: manually edited --> in the module so that it’s not manually updated with imports
Note
The custom widgetset xml needs to import MprWidgetSet e.g. <inherits name="com.vaadin.mpr.MprWidgetSet"/>
Tip
After changing the widgetset xml, remember to recompile it. When using Vaadin Maven plugin, you can run mvn vaadin:compile.