You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Andriy Redko (JIRA)" <ji...@apache.org> on 2017/10/29 18:01:00 UTC

[jira] [Updated] (CXF-7544) Support @Context-based injection into proxied CDI beans

     [ https://issues.apache.org/jira/browse/CXF-7544?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andriy Redko updated CXF-7544:
------------------------------
    Description: 
The issue pop up as part of https://github.com/apache/cxf/pull/330 discussion. In case when provider / feature / resource is a proxied CDI bean, the contextual class members (annotated with @Context) are not injected.

Test case to reproduce:

{code}
@ApplicationScoped
public class BookStoreRequestFilter implements ContainerRequestFilter {
    @Context private ResourceInfo resourceInfo;
    
    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        // Contextual instances should be injected independently
        if (resourceInfo == null || resourceInfo.getResourceMethod() == null) {
            requestContext.abortWith(Response.serverError().build());
        }
    }
}
{code}

CC [~rmannibucau]

  was:
The issue pop up as part of https://github.com/apache/cxf/pull/330 discussion. In case when provider / feature / resource is a proxied CDI bean, the contextual class members (annotated with @Context) are not injected.

Test case to reproduce:

{code}
@ApplicationScoped
public class BookStoreRequestFilter implements ContainerRequestFilter {
    @Context private ResourceInfo resourceInfo;
    
    @Override
    public void filter(ContainerRequestContext requestContext) throws IOException {
        // Contextual instances should be injected independently
        if (resourceInfo == null || resourceInfo.getResourceMethod() == null) {
            requestContext.abortWith(Response.serverError().build());
        }
    }
}
{code}




> Support @Context-based injection into proxied CDI beans
> -------------------------------------------------------
>
>                 Key: CXF-7544
>                 URL: https://issues.apache.org/jira/browse/CXF-7544
>             Project: CXF
>          Issue Type: Bug
>    Affects Versions: 3.1.13, 3.2.0
>            Reporter: Andriy Redko
>            Assignee: Andriy Redko
>
> The issue pop up as part of https://github.com/apache/cxf/pull/330 discussion. In case when provider / feature / resource is a proxied CDI bean, the contextual class members (annotated with @Context) are not injected.
> Test case to reproduce:
> {code}
> @ApplicationScoped
> public class BookStoreRequestFilter implements ContainerRequestFilter {
>     @Context private ResourceInfo resourceInfo;
>     
>     @Override
>     public void filter(ContainerRequestContext requestContext) throws IOException {
>         // Contextual instances should be injected independently
>         if (resourceInfo == null || resourceInfo.getResourceMethod() == null) {
>             requestContext.abortWith(Response.serverError().build());
>         }
>     }
> }
> {code}
> CC [~rmannibucau]



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)