[weld-issues] [JBoss JIRA] (WELD-1016) Weld creates multiple interceptor instances per target instance

Jozef Hartinger (Created) (JIRA) jira-events at lists.jboss.org
Sat Nov 19 09:38:40 EST 2011

Weld creates multiple interceptor instances per target instance

                 Key: WELD-1016
                 URL: https://issues.jboss.org/browse/WELD-1016
             Project: Weld
          Issue Type: Bug
          Components: Interceptors and Decorators
    Affects Versions: 1.1.2.Final
            Reporter: Jozef Hartinger
             Fix For: 1.1.4.Final, 2.0.0.Final

The CDI spec says:
An interceptor instance is a dependent object of the object it inter-cepts.

The Interceptors spec says:
The lifecycle of an interceptor instance is the same as that of the target class instance with which it
is associated. When the target instance is created, a corresponding interceptor instance is created for
each associated interceptor class. These interceptor instances are destroyed when the target instance
is removed.

and also

An interceptor instance may hold state.

It is clear that at most one instance of an interceptor class should be created for an instance of a CDI bean. However, Weld currently creates an instance per method per target instance.

Having a simple intercepted bean:
public class Lion
    public Object foo() {
        return null;

    public Object bar() {
        return null;

* multiple invocations of a single method (e.g. foo()) are intercepted by the same interceptor instance
* when invoking different methods on the same bean instance, every method is intercepted by a different interceptor instance - which is wrong

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the weld-issues mailing list