vaadin / framework

Vaadin 6, 7, 8 is a Java framework for modern Java web applications.
http://vaadin.com/
Other
1.77k stars 729 forks source link

ProductionMode in Annotations with Vaadin 8 OSGi Liferay portlet #12543

Open mikke-alekstra opened 2 years ago

mikke-alekstra commented 2 years ago

I was unable to find documentation about how to turn productionMode on with Vaadin 8 OSGi Liferay Portlets using Annotations. The document I refer to is https://vaadin.com/docs/v8/framework/portal/portal-osgi.

However, after some debugging with Vaadin 8.14.3 server's checkProductionMode method it seemed that there are (at least) two options to choose from to get a Liferay OSGi portlet with Annotations to turn productionMode on.

  1. Turn on production mode globally by adding JVM parameter -Dvaadin.productionMode=true

or

  1. Turn on production mode for a single portlet by adding productionMode property into @Component annotation. A sample @Component annotation with production mode turned on would look like this:
    @Component(service = UI.class, property = {
        "com.liferay.portlet.display-category=category.vaadin",
        "javax.portlet.name=my.vaadin.app.app.1.0.0",
        "javax.portlet.display-name=Tutorial Portlet",
        "javax.portlet.security-role-ref=power-user,user",
        "javax.portlet.init-param.productionMode=true",
        "com.vaadin.osgi.liferay.portlet-ui=true"},
        scope = ServiceScope.PROTOTYPE)

@VaadinLiferayPortletConfiguration does not support productionMode parameter and adding productionMode property into the @Component annotation when using @VaadinLiferayPortletConfiguration had no affect.

I also noticed that if a Liferay page contained multiple Vaadin portlets, turning productionMode to false in one portlet enabled debug mode for all portlets on that page.

I used Liferay 7.3.5 & Vaadin 8.14.3 and Liferay 7.4.3.10 & Vaaadin 8.16.0 in my tests.

TatuLund commented 1 year ago

For me use of @Component sounds the like the better option.