[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdi-dev] Open question regarding @AroundInvoke on target classes in CDI Lite
|
This post peeked my interest so I grepped some of our code and we
always use @AroundInvoke in a dedicated @Interceptor annotated
class.
I don't think I even knew you could do it on a target class and
that seems like unnecessary dark magic. Sure seems a bit useful if
you have a non-reusable interception needs for a specific bean but
it's not an earth shattering feature.
Just 2 cents from a daily developer.
On 7. 09. 21 16:47, Matej Novotny
wrote:
Hello,
there have been some discussions around what interception
is supported in Lite and a sort of agreement was reached over
the course of time with a notable exception of `@AroundInvoke`
declared on a bean class.
Here is a link to a table summarizing what was generally
agreed upon[1].
In short, all kinds of lifecycle callbacks are supported,
but we want to only support interceptors declared with
bindings plus priority as means on enablement.
The open question is @AroundInvoke declared on target class
which looks something like this:
@ApplicationScoped
public class Foo { // a standard bean class declaration
@AroundInvoke
public
Object intercept2(InvocationContext ctx) throws
Exception {
return ctx.proceed(); // interceptor declaration inside bean
}
public void ping(){
doSomething(); // some bean method that would be
intercepted
}
}
The above is a very rarely used case of interception which
the interceptors specification only briefly mentions in this
section[2].
It brings no new functionality as such behavior can be
easily achieved via standard java means. Alternatively, you
can just declare a standard interceptor with binding and
around invoke method on it. See this comment[3] by Martin for
details.
Therefore, my suggestion is to drop this feature from the
initial version of CDI Lite. We can always revisit if we see
this feature is requested or even required by some use case
which we haven't thought of so far. Thoughts,
agreements/disagreements, ideas are welcome :-)
Regards
Matej
___________________________________________
_______________________________________________
cdi-dev mailing list
cdi-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdi-dev