From f11ea958cce7a3b273bc041e6a20a399dd23e6ac Mon Sep 17 00:00:00 2001 From: Tatu Lund Date: Thu, 14 Mar 2019 21:24:59 +0200 Subject: [PATCH] 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. --- .../java/com/vaadin/server/BrowserWindowOpener.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 -- 2.39.5