<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    Other than this I am not aware of any other way of suppressing
    CDI/Weld injection. Since you have control over the producer methods
    you could perhaps implement this on the JBeret side using thread
    locals to pass the injected instance/default values around?<br>
    <br>
    <div class="moz-cite-prefix">On 03/09/2015 03:43 PM, Cheng Fang
      wrote:<br>
    </div>
    <blockquote cite="mid:54FDB182.9010809@redhat.com" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      (I just subscribed to cdi-dev, and tried to post to it several
      times, but bounced back, so send to you)<br>
      <br>
      Thanks, Jozef.<br>
      <br>
      I'm mostly concerned with user-supplied default field values.� For
      JVM default field values, we currently just let CDI inject null,
      or primitive defaults to it.<br>
      <br>
      I just tried your suggestion, adding the following method to
      BatchCDIExtension class:<br>
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      <pre style="background-color:#ffffff;color:#000000;font-family:'Menlo';font-size:12pt;"><span style="color:#000080;font-weight:bold;">public </span>&lt;<span style="color:#20999d;">T</span>&gt; <span style="color:#000080;font-weight:bold;">void </span>processAnnotatedType(<span style="color:#808000;">@Observes </span>ProcessAnnotatedType&lt;<span style="color:#20999d;">T</span>&gt; pat,
                                     BeanManager beanManager) {...}

and found batch properties are not yet available when it is called.  This method seems to be called during scanning, which is
pretty early stage.

</pre>
      Cheng<br>
      <br>
      <div class="moz-cite-prefix">On 3/9/15 2:39 AM, Jozef Hartinger
        wrote:<br>
      </div>
      <blockquote cite="mid:54FD4033.2030706@redhat.com" type="cite">
        <meta content="text/html; charset=windows-1252"
          http-equiv="Content-Type">
        You can actually work around by listening to
        ProcessAnnotatedType and removing the @Inject annotation from
        injection points for which there is no value to inject. Is the
        set of defined key-value pairs known at the time when the CDI
        extension is called?<br>
        <br>
        Jozef<br>
        <br>
        <div class="moz-cite-prefix">On 03/09/2015 07:25 AM, Jozef
          Hartinger wrote:<br>
        </div>
        <blockquote cite="mid:54FD3CE0.1070706@redhat.com" type="cite">
          <meta content="text/html; charset=windows-1252"
            http-equiv="Content-Type">
          Adding weld-dev.<br>
          <br>
          Hi Cheng,<br>
          <br>
          by defining a producer method you are basically saying "I am
          able to supply an object for this given type/qualifier
          combination". There is not way to opt out of it at runtime.
          Are you concerned about the JVM default values or the default
          values a user has provided?<br>
          <br>
          Jozef<br>
          <br>
          <div class="moz-cite-prefix">On 03/07/2015 05:54 PM, Cheng
            Fang wrote:<br>
          </div>
          <blockquote cite="mid:54FB2D34.5090005@redhat.com" type="cite">
            <meta http-equiv="content-type" content="text/html;
              charset=windows-1252">
            Hi Jozef,<br>
            <br>
            I'm having a question in using CDI injection in project
            JBeret (batch impl project), and would appreciate any help
            from you.<br>
            <br>
            A batch application (in Java SE or EE) can inject configured
            batch properties into batch artifact classes:<br>
            <br>
            @Inject<br>
            @javax.batch.api.BatchProperty(name = "batchPropName")<br>
            String batchPropName = "default name";<br>
            <br>
            The property value comes from job.xml, which is the batch
            job definition descriptor file:<br>
            <br>
            <meta http-equiv="content-type" content="text/html;
              charset=windows-1252">
            &lt;batchlet ref="batchlet1"&gt;<br>
            ������� &lt;properties&gt;<br>
            �������������� &lt;property name="batchPropName"
            value="configured name"/&gt;<br>
            ������� &lt;/properties&gt;<br>
            ...<br>
            <br>
            When "batchPropName" property is not configured in job.xml,
            the injection should not happen, and whatever java default
            field value should be preserved for batchPropName field.� <br>
            <br>
            With our current batch CDI extension [1] and producer bean
            [2], it injects a null value into this field, overwriting
            the java default value, when the target batch property is
            not present.<br>
            <br>
            How to signal to Weld to skip performing the injection for
            those injection targets?� Ideally, I hope it can be done
            from within producer methods, which is the place we retrieve
            batch properties and know whether they exist or not.<br>
            <br>
            I think this is also how Java EE field injection works.� How
            do we handle it in EE, and is it something I can mirror?<br>
            <br>
            Thanks,<br>
            Cheng<br>
            <br>
            [1] <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://github.com/jberet/jsr352/blob/master/jberet-core/src/main/java/org/jberet/creation/BatchCDIExtension.java">https://github.com/jberet/jsr352/blob/master/jberet-core/src/main/java/org/jberet/creation/BatchCDIExtension.java</a><br>
            <br>
            [2] <a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://github.com/jberet/jsr352/blob/master/jberet-core/src/main/java/org/jberet/creation/BatchBeanProducer.java">https://github.com/jberet/jsr352/blob/master/jberet-core/src/main/java/org/jberet/creation/BatchBeanProducer.java</a><br>
            <br>
            <br>
          </blockquote>
          <br>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
weld-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:weld-dev@lists.jboss.org">weld-dev@lists.jboss.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/weld-dev">https://lists.jboss.org/mailman/listinfo/weld-dev</a></pre>
        </blockquote>
        <br>
      </blockquote>
      <br>
    </blockquote>
    <br>
  </body>
</html>