title: Autowired spring bean to custom slf4j appender
body: <p>Using AspectJ I've injected service into non-managed domain object:
  This is service:</p>
  
  <pre><code>@Service
  public class DomainServiceImpl implements DomainService { 
       public String getLoggerMessage(String prevMessage) {
              return String.format("Message from logger service:%s", prevMessage);
      }
  }
  </code></pre>
  
  <p>This is domain object:</p>
  
  <pre><code>@Configurable(dependencyCheck = true)
  public class DomainObject {
      private IAppenderService appenderService;
      @Autowired
      public void setAppenderService(IAppenderService appenderService) {
          this.appenderService = appenderService;
      }
      public IAppenderService getAppenderService() {
          return appenderService;
      }   
  
      public String formMessage(String message){      
          return appenderService.getLoggerMessage(message);
      }   
  }
  </code></pre>
  
  <p>Following test was successfull:</p>
  
  <pre><code>@Test
      public void testAppender(){
          DomainObject domainObject = new DomainObject();
          assertNotNull(domainObject.getAppenderService());
      }
  </code></pre>
  
  <p>and if I add </p>
  
  <pre><code>System.out.println(new DomainObject().formMessage("test message"));
  </code></pre>
  
  <p>to any controller i've got expected string in console:
  "Message from logger service:test message"</p>
  
  <p>Then I try use this service into custom slf4j appender:</p>
  
  <pre><code>@Configurable(dependencyCheck = true)
  public class MyAppender extends AppenderSkeleton {  
      IAppenderService    appenderService;        
      @Autowired
      public void setAppenderService(IAppenderService appenderService) {
          this.appenderService = appenderService;
      }
      public IAppenderService getAppenderService() {
          return appenderService;
      }
      @Override
      public void close() {
      }
      @Override
      public boolean requiresLayout() {       
          return false;
      }
      @Override
      protected void append(LoggingEvent event) {     
          System.out.println(new DomainObject().formMessage(event.getMessage().toString()));
      }
  }
  </code></pre>
  
  <p>but gotta the NPE:</p>
  
  <pre><code>java.lang.NullPointerException
      at sbk.spring.testaopjc.domain.DomainObject.formMessage(DomainObject.java:19)
      at sbk.spring.testaopjc.appender.MyAppender.append(MyAppender.java:29)
      at org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
  </code></pre>
  
  <p>at same time following test was successfull:</p>
  
  <pre><code>public void testAppendeSecond(){
          MyAppender appender = new MyAppender();
          assertNotNull(appender.getAppenderService());
      }
  </code></pre>
  
  <p>Can anybody explain me why MyAppender behaves differently in this cases?
  PS:My log4j.properties file:</p>
  
  <pre><code> log4j.rootLogger=INFO, STDOUT
  
   log4j.appender.STDOUT=sbk.spring.testaopjc.appender.MyAppender
   log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
   log4j.appender.STDOUT.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%M:%L - %m%n
  </code></pre>