[weld-dev] @WithAnnotations bug?

Martin Kouba mkouba at redhat.com
Wed Jan 29 08:27:16 EST 2014


Hi Kristoffer,

the javadoc is wrong, CDI should follow JSL rules here - i.e. only if
@Inherited meta-annotation is present the annotation is inherited and
the type is observed. @Path has not @Inherited defined. Therefore only
resources with this annotation will be observed.

See also:
https://issues.jboss.org/browse/CDI-318
(will be fixed in CDI 1.2 MR)

Martin

Dne 28.1.2014 11:14, Kristoffer Sjögren napsal(a):
> Hi
> 
> Extensions that observe using @WithAnnotations are not notified with
> implementing classes for annotated interfaces. 
> 
> Not sure if this is intended - the javadoc seems pretty clear on that
> the following example should work.
> 
> @Path("/service")
> public interface Service {
>   @POST
>   public void execute();
> }
> 
> public ServiceEndpoint implements Service {
>    public void execute() { ... }
> }
> 
> public class JaxrsExtension implements Extension {
> 
> <X> void storeJaxrsResourceClasses(@Observes
> @WithAnnotations({Path.class, Provider.class}) ProcessAnnotatedType<X>
> pat) {
>     AnnotatedType<X> type = pat.getAnnotatedType();
>     if (!type.getJavaClass().isInterface()) {
>        // want to manage the ServiceEndpoint here
>     }
>   }
> }
> 
> Cheers,
> -Kristoffer
> 
> 
> _______________________________________________
> weld-dev mailing list
> weld-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/weld-dev
> 


More information about the weld-dev mailing list