For portlet applications, CDI is activated in the very same way as for any other application: a WEB-INF/beans.xml file needs to be present inside the WAR, as defined by the JSR 299 specification. There are no additional configurations required to use CDI within your portlet or portlet filter.
Any portlet class extending GenericPortlet or implementing Portlet interface, and any portlet filter class implementing PortletFilter, RenderFilter, ActionFilter, EventFilter or ResourceFilter, is able to have CDI beans injected into it, even though it is not directly managed by the CDI container. Just as with any kind of injection, its only a matter of using @Inject and the type of the bean you want to have injected.
|At the point at which the injection is performed on the portlet class or filter some contexts will not be active, such as session, which will cause ContextNotActiveException to appear if that context is relied upon. Such a situation could arise if the bean being injected is produced by a bean that is in session scope.|
There is CDI Generic Portlet example available in our Quickstarts Collection with a basic portlet and portlet filter using CDI. Another quickstart therein, CDI Portlet with JSF, shows the usage of CDI in combination with JSF.