You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by "Neil Griffin (JIRA)" <ji...@apache.org> on 2018/04/18 23:59:00 UTC

[jira] [Created] (PLUTO-702) Portlet classes in PortletHubDemo are not annotated with @ApplicationScoped

Neil Griffin created PLUTO-702:
----------------------------------

             Summary: Portlet classes in PortletHubDemo are not annotated with @ApplicationScoped
                 Key: PLUTO-702
                 URL: https://issues.apache.org/jira/browse/PLUTO-702
             Project: Pluto
          Issue Type: Bug
          Components: demo portlets
    Affects Versions: 3.0.0
            Reporter: Neil Griffin
            Assignee: Neil Griffin
             Fix For: 3.0.1


Section 20.1 of the Portlet 3.0 Specification states:
{quote}
When the portlet container uses the CDI container to instantiate the portlets, it must respect
any scope annotations on the portlet beans. Generally, portlets should be @ApplicationScoped  in order to avoid unnecessary object creation and destruction.
It should be noted that regardless of the bean scope, the Portlet interface init(PortletConfig) method will only be called a single time when the portlet is taken into service. If the portlet bean scope is other than @ApplicationScoped or @Dependent, this can potentially lead to unintended effects. Portlets that do not directly or indirectly implement the Portlet interface can use the CDI @PostConstruct and @PreDestroy annotations to properly handle bean initialization and tear down. A PortletConfig object can be injected as necessary.{quote}

Since all of the portlet classes annotated with {{@PortletConfiguration}} in the PortletHubDemo extends {{GenericPortlet}}, they indirectly implement the {{Portlet}} interface. This means that the "unintended effects" can happen in various portlet containers.

Because of this, it is necessary to annotated each of these classes with the {{@ApplicationScoped}} annotation.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)