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 2019/01/07 11:50:00 UTC

[jira] [Assigned] (CXF-7921) JAXRS CDI extension ignores interfaces annotations

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

Andriy Redko reassigned CXF-7921:
---------------------------------

    Assignee: Andriy Redko

> JAXRS CDI extension ignores interfaces annotations
> --------------------------------------------------
>
>                 Key: CXF-7921
>                 URL: https://issues.apache.org/jira/browse/CXF-7921
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 3.2.7
>            Reporter: Romain Manni-Bucau
>            Assignee: Andriy Redko
>            Priority: Major
>
> https://github.com/apache/cxf/blob/master/integration/cdi/src/main/java/org/apache/cxf/cdi/JAXRSCdiResourceExtension.java#L194 should also consider interfaces of the annotated type cause they can host @Path in a contract driven approach
> Here is a version for collect method:
> {code}
> if (!event.getAnnotated().isAnnotationPresent(Path.class) && AnnotatedType.class.isInstance(event.getAnnotated())) {
>                 final AnnotatedType<?> type = AnnotatedType.class.cast(event.getAnnotated());
>                 // note: should we use Annotated for interfaces as well?
>                 if (type.getTypeClosure().stream()
>                         .filter(it -> Class.class.isInstance(it) && Class.class.cast(it).isInterface())
>                         .map(Class.class::cast)
>                         .map((Function<Class, AnnotatedType>) beanManager::createAnnotatedType) // todo: add beanManager as param of the collect method
>                         .anyMatch(c -> c.isAnnotationPresent(Path.class))) {
>                     try {
>                         List.class.cast(serviceBeans.get(this)).add(event.getBean());
>                         return;
>                     } catch (final IllegalAccessException e) {
>                         new org.apache.meecrowave.logging.tomcat.LogFacade(Cxfs.class.getName())
>                                 .error(e.getMessage(), e);
>                     }
>                 }
>             }
> // else current code
> {code}



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