From: Tatu Lund Date: Thu, 14 Mar 2019 19:24:59 +0000 (+0200) Subject: Add note about dependency injection in BrowserWindowOpener JavaDocs (#11495) X-Git-Tag: 8.8.0.beta1~25 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f11ea958cce7a3b273bc041e6a20a399dd23e6ac;p=vaadin-framework.git Add note about dependency injection in BrowserWindowOpener JavaDocs (#11495) If BrowserWindowOpener is used with constructor using Class as parameter, it will have UI provider with generated url. This will not match UI beans in contextual storage and hence newly created UI will not be managed bean. Due this, injection to new UI instance will not happen. If you are using CDI , BrowserWindowOpener(String) constructor needs to be used. --- diff --git a/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java b/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java index ebc31c06cc..0e59784d76 100644 --- a/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java +++ b/server/src/main/java/com/vaadin/server/BrowserWindowOpener.java @@ -70,7 +70,12 @@ public class BrowserWindowOpener extends AbstractExtension { /** * Creates a window opener that will open windows containing the provided UI * class. - * + *

+ * Note: The new UI instance will not work with dependency injection (CDI and + * Spring). Use {@link BrowserWindowOpener(String)} instead. + * {@code VaadinServlet.getCurrent().getServletContext().getContextPath()} gives + * the current context path. + * * @param uiClass * the UI class that should be opened when the extended component * is clicked @@ -82,6 +87,11 @@ public class BrowserWindowOpener extends AbstractExtension { /** * Creates a window opener that will open windows containing the provided UI * using the provided path. + *

+ * Note: The new UI instance will not work with dependency injection (CDI + * and Spring). Use {@link BrowserWindowOpener(String)} instead. + * {@code VaadinServlet.getCurrent().getServletContext().getContextPath()} gives + * the current context path. * * @param uiClass * the UI class that should be opened when the extended component