title: CDI Injection and serialization
body: <p>I'm considering to use CDI injection for slf4j logger, so I've created a producer.</p>
  
  <p>I'm injecting it into an <code>ApplicationScoped</code> bean which is serializable:</p>
  
  <pre><code>@ApplicationScoped
  public final class CurrentApplicationBean implements Serializable {
      @Inject
      private transient Logger          logger;
  }
  </code></pre>
  
  <p>It must be transient because <code>org.slf4j.Logger</code> is an interface which doesn't extend <code>Serializable</code>, but this means that the logger must be re-injected after deserialization.</p>
  
  <p><strong>I think that CDI doesn't handle that, what's you knowledge?</strong></p>
  
  <p>Moreover, the provider always provides a new <code>Logger</code> instance beacuse it must set the logger name from the <code>InjectionPoint</code>, this means that <code>RequestScoped</code> beans have their own logger instance instead of a static per class logger.</p>
  
  <p><strong>Maybe logging is not a good context for CDI injection... what are your considerations?</strong></p>