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 2021/04/13 22:01:00 UTC
[jira] [Updated] (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 updated CXF-7921:
------------------------------
Fix Version/s: 3.3.11
3.4.4
3.5.0
> 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, 3.4.3, 3.3.10
> Reporter: Romain Manni-Bucau
> Assignee: Andriy Redko
> Priority: Major
> Fix For: 3.5.0, 3.4.4, 3.3.11
>
>
> 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
(v8.3.4#803005)