Using a custom legacy UI class

Note
This is intended for advanced cases only, where using the recommended migration path is not enough to cover specific logic that cannot be easily ported to Flow.

If you have a need for a specific UI class to be used for the legacy Vaadin UI you can have the UI class extend MprUI. Note that the UI can not be used for layouting purposes.

public class MyCustomUI extends MprUI {
    @Override
    protected void init(VaadinRequest request) {
        super.init(request);
    }
}
Note
You need to call super.init(request) if you need to override the init method

Then you need to tell the application that this class should be used with the annotation @LegacyUI().

@Route("")
@LegacyUI(MyCustomUI.class)
public class MainLayout extends Div {
}

Now when navigating to the "" (root) route you will get a MyCustomUI instead of the default MprUI.