Think I found bug with interceptor
by Michael Remijan
Greetings,
I am using:
<dependency>
<groupId>org.jboss.weld.se</groupId>
<artifactId>weld-se-core</artifactId>
<version>3.0.0.Alpha15</version>
</dependency>
and I think I found a bug with the interceptors. I wanted to ask about it first before I put it in Jira.
Basically, the interceptor I have defined works great if I annotate a method called by the CDI container, which in my case is an method observing for an event. I have an ExceptionRetryInterceptor class and an ExceptionRetry annotation. If I annotate an observer method like this:
@ExceptionRetrypublic void send(
@Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt
) throws MessagingException, IOException {....}
No problem, everything works fine. I can see the interceptor code being called in my logs.
Now here's the problem, If I use this annotation on just a regular method which I call myself, it DOES NOT work. So if I refactor the above example so the annotation is NOT on the observer method called by the container, then the doSend() method below does NOT get wrapped by the interceptor:
public void send(
@Observes @Priority(SEND_EMAIL_MESSAGE) EmailEvent evnt
) throws MessagingException, IOException { //.... doSend();}
@ExceptionRetrypublic void doSend() {....} // this method does not get wrapped by the interceptor
I'm trying to figure out why. My ExceptionRetryInterceptor class has a @Priority set on it and that works fine. But I've also tried setting <interceptors> in beans.xml but the doSend(){...} method still doesn't get wrapped.
Any thoughts/help?
7 years, 5 months
Repeating annotations support (CDI-460 and CDI-471)
by Antonin Stefanutti
Hi,
While CDI-471 (Support repeating qualifiers in typesafe resolution mechanism) targets CDI 2.0, related issue CDI-460 (Support repeating annotations in CDI SPI) doesn’t have any fix version defined. Can it be implied that CDI-460 will be addressed with CDI-471 or is it intentional left undefined? IMHO, it’d be important to have CDI-460 delivered as part of CDI 2.0 as well to bring a consistent support for repeating annotations in CDI.
Thanks,
Antonin
7 years, 5 months
[JBoss JIRA] (CDI-460) Support repeating annotations in CDI SPI
by John Ament (JIRA)
[ https://issues.jboss.org/browse/CDI-460?page=com.atlassian.jira.plugin.sy... ]
John Ament closed CDI-460.
--------------------------
Resolution: Done
Closing out - CDI-471 is going to encompass the repeating changes required in the spec.
> Support repeating annotations in CDI SPI
> ----------------------------------------
>
> Key: CDI-460
> URL: https://issues.jboss.org/browse/CDI-460
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Antonin Stefanutti
> Fix For: 2.0 .Final
>
>
> In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:
> {{AnnotatedType.getAnnotations()}} and {{ProcessAnnotatedType.setAnnotatedType(AnnotatedType at)}},
> {{BeanAttributes.getQualifiers()}}, and {{ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba)}},
> {{InjectionPoint.getQualifiers}} and {{ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip)}}.
> Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004], that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.
> Given that Java 8 provides support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it seems logical to have repeating annotations supported at the CDI SPI level. Though, that's important to have that support explicitly stated and specified in CDI.
> Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004] as long as that support will be made explicit in the specification.
> That applies as well for {{EventMetadata.getQualifiers}} in _read-only_.
> While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 5 months
[JBoss JIRA] (CDI-471) Support repeating qualifiers in typesafe resolution mechanism
by John Ament (JIRA)
[ https://issues.jboss.org/browse/CDI-471?page=com.atlassian.jira.plugin.sy... ]
Work on CDI-471 started by John Ament.
--------------------------------------
> Support repeating qualifiers in typesafe resolution mechanism
> -------------------------------------------------------------
>
> Key: CDI-471
> URL: https://issues.jboss.org/browse/CDI-471
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Resolution
> Reporter: Antonin Stefanutti
> Assignee: John Ament
> Labels: F2F2016
> Fix For: 2.0 .Final
>
>
> As Java 8 provides improved support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it would be valuable to percolate that support into the CDI typesafe resolution mechanism.
> For example, one could write:
> {code}
> @Qualifier
> @Repeatable(ContextNames.class)
> public interface @ContextName {
> String value;
> }
> public @interface ContextNames {
> ContextName[] value();
> }
> {code}
> And then:
> {code}
> @ContextName("ctx1")
> class CamelContext1 {
> }
> @ContextName("ctx2")
> class CamelContext2 {
> }
> @Uri("")
> @Produces
> @ContextName("ctx1")
> @ContextName("ctx2")
> static ProducerTemplate producerTemplate(InjectionPoint ip, @Any Instance<CamelContext> instance) {
> }
> {code}
> That enables to use annotations both as a CDI qualifiers and a metadata providers while still be relying on standard typesafe resolution mechanism during the deployment phase to detect unsatisfied or ambiguous dependencies.
> Support of the annotation container / list for backward compatibility could be provided as well.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 5 months
[JBoss JIRA] (CDI-471) Support repeating qualifiers
by John Ament (JIRA)
[ https://issues.jboss.org/browse/CDI-471?page=com.atlassian.jira.plugin.sy... ]
John Ament updated CDI-471:
---------------------------
Summary: Support repeating qualifiers (was: Support repeating qualifiers in typesafe resolution mechanism)
> Support repeating qualifiers
> ----------------------------
>
> Key: CDI-471
> URL: https://issues.jboss.org/browse/CDI-471
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Resolution
> Reporter: Antonin Stefanutti
> Assignee: John Ament
> Labels: F2F2016
> Fix For: 2.0 .Final
>
>
> As Java 8 provides improved support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it would be valuable to percolate that support into the CDI typesafe resolution mechanism.
> For example, one could write:
> {code}
> @Qualifier
> @Repeatable(ContextNames.class)
> public interface @ContextName {
> String value;
> }
> public @interface ContextNames {
> ContextName[] value();
> }
> {code}
> And then:
> {code}
> @ContextName("ctx1")
> class CamelContext1 {
> }
> @ContextName("ctx2")
> class CamelContext2 {
> }
> @Uri("")
> @Produces
> @ContextName("ctx1")
> @ContextName("ctx2")
> static ProducerTemplate producerTemplate(InjectionPoint ip, @Any Instance<CamelContext> instance) {
> }
> {code}
> That enables to use annotations both as a CDI qualifiers and a metadata providers while still be relying on standard typesafe resolution mechanism during the deployment phase to detect unsatisfied or ambiguous dependencies.
> Support of the annotation container / list for backward compatibility could be provided as well.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 5 months
[JBoss JIRA] (CDI-460) Support repeating annotations in CDI SPI
by Antonin Stefanutti (JIRA)
[ https://issues.jboss.org/browse/CDI-460?page=com.atlassian.jira.plugin.sy... ]
Antonin Stefanutti updated CDI-460:
-----------------------------------
Fix Version/s: 2.0 .Final
> Support repeating annotations in CDI SPI
> ----------------------------------------
>
> Key: CDI-460
> URL: https://issues.jboss.org/browse/CDI-460
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Antonin Stefanutti
> Fix For: 2.0 .Final
>
>
> In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:
> {{AnnotatedType.getAnnotations()}} and {{ProcessAnnotatedType.setAnnotatedType(AnnotatedType at)}},
> {{BeanAttributes.getQualifiers()}}, and {{ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba)}},
> {{InjectionPoint.getQualifiers}} and {{ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip)}}.
> Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004], that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.
> Given that Java 8 provides support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it seems logical to have repeating annotations supported at the CDI SPI level. Though, that's important to have that support explicitly stated and specified in CDI.
> Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004] as long as that support will be made explicit in the specification.
> That applies as well for {{EventMetadata.getQualifiers}} in _read-only_.
> While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 5 months
[JBoss JIRA] (CDI-460) Support repeating annotations in CDI SPI
by Antonin Stefanutti (JIRA)
[ https://issues.jboss.org/browse/CDI-460?page=com.atlassian.jira.plugin.sy... ]
Antonin Stefanutti updated CDI-460:
-----------------------------------
Description:
In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:
{{AnnotatedType.getAnnotations()}} and {{ProcessAnnotatedType.setAnnotatedType(AnnotatedType at)}},
{{BeanAttributes.getQualifiers()}}, and {{ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba)}},
{{InjectionPoint.getQualifiers}} and {{ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip)}}.
Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004], that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.
Given that Java 8 provides support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it seems logical to have repeating annotations supported at the CDI SPI level. Though, that's important to have that support explicitly stated and specified in CDI.
Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004] as long as that support will be made explicit in the specification.
That applies as well for {{EventMetadata.getQualifiers}} in _read-only_.
While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.
was:
In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:
{{AnnotatedType.getAnnotations()}} and {{ProcessAnnotatedType.setAnnotatedType(AnnotatedType at)}},
{{BeanAttributes.getQualifiers()}}, and {{ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba)}},
{{InjectionPoint.getQualifiers}} and {{ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip)}}.
Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004], that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.
Given that Java 8 provides support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it seems logical to have repeating annotations supported at the CDI SPI level. Tough, that's important to have that support explicitly stated and specified in CDI.
Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004] as long as that support will be made explicit in the specification.
That applies as well for {{EventMetadata.getQualifiers}} in _read-only_.
While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.
> Support repeating annotations in CDI SPI
> ----------------------------------------
>
> Key: CDI-460
> URL: https://issues.jboss.org/browse/CDI-460
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Antonin Stefanutti
>
> In CDI 1.2, it is not explicitly stated whether altering the annotation-based metadata in a way to add multiple annotations of the same type is possible or not. That situation occurs with the following combinations:
> {{AnnotatedType.getAnnotations()}} and {{ProcessAnnotatedType.setAnnotatedType(AnnotatedType at)}},
> {{BeanAttributes.getQualifiers()}}, and {{ProcessBeanAttributes.setBeanAttributes(BeanAttributes ba)}},
> {{InjectionPoint.getQualifiers}} and {{ProcessInjectionPoint.setInjectionPoint(InjectionPoint ip)}}.
> Being able to decorate these metadata with repeating annotations enables powerful and elegant use cases as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004], that is the ability to use an annotation both as a CDI qualifier and a metadata provider during injection.
> Given that Java 8 provides support for [repeating annotations|http://docs.oracle.com/javase/tutorial/java/annotations/repea...], it seems logical to have repeating annotations supported at the CDI SPI level. Though, that's important to have that support explicitly stated and specified in CDI.
> Indeed, while Weld permits metadata alteration with repeating annotations, OpenWebBeans does not for the moment though developers understand the need and are willing to open that behavior as discussed in [OWB-1004|https://issues.apache.org/jira/browse/OWB-1004] as long as that support will be made explicit in the specification.
> That applies as well for {{EventMetadata.getQualifiers}} in _read-only_.
> While that request is technically independent from Java 8, it is correlated to the support of repeating qualifiers in the typesafe resolution mechanism that is likely to be treated as part of the Java 8 stream of the CDI 2.0 specification.
--
This message was sent by Atlassian JIRA
(v7.2.3#72005)
7 years, 5 months