3 Replies Latest reply on Dec 11, 2014 4:55 AM by Tom Wright

    No DefinitionException when missing @Inject on decorator constructor

    Tom Wright Newbie

      The spec states in 8.1.2: "A decorator must have exactly one delegate injection point. If a decorator ... does not have a delegate injection point, the container automatically detects the problem and treats it as a definition error."


      I'm having a problem where the code below, missing @Inject on the constructor, isn't causing a DefinitionException, it's just silently not being picked up as a decorator. If I instead use a field injection point and forget the @Inject, then I do get a DefinitionException:


      org.jboss.weld.exceptions.DefinitionException: WELD-000059: No delegate injection points defined for [EnhancedAnnotatedTypeImpl] public @Priority @Decorator class com.misc.MyDecorator


      public abstract class MyDecorator implements MyInterface {
          // Doing this instead behaves correctly
          // @Any
          // @Delegate
          // Bean bean;
          // missing @Inject
          public MyDecorator(@Delegate @Any MyInterface decoratedBean) {
          public String getString() {
              return "String";


      Any idea what's going on here? Is this a bug in Weld?


      Thanks for any help