Favicon For Vaadin Webapp

Viewed 581

I am using Vaadin 20 Flow (Java) and want to assign an icon/image (.ico or .png) to my web app. This icon should be displayed besides the page title and should be used as an icon when the page is bookmarked.

I know that it was possible to assign these icons through implementing the interface PageConfigurator. However, this functional interface is now deprecated. Does anyone know how to implement such a favicon in the new Vaadin versions?

1 Answers

Use AppShellConfigurer:

AppShellConfigurator is a replacement of the obsolete PageConfigurator interface.

public class AppShell implements AppShellConfigurator {

  @Override
  public void configurePage(AppShellSettings settings) {
    // ...
    settings.addFavIcon("icon", "icons/icon-192.png", "192x192");
    settings.addLink("shortcut icon", "icons/favicon.ico");
    // ...
  }
}
Related