Results 1 to 6 of 6

Thread: Custom log4J dependecy injection problem (ioc)

Threaded View

  1. #1
    Join Date
    Mar 2010
    Location
    PARIS
    Posts
    10

    Post Custom log4J dependecy injection problem (ioc)

    hello
    I am trying to write a custom Log4J by extending AppenderSkeleton class provided by Log4j, but I can't have the dependency injection realizaed in HibernateAppenderDAO class
    My variable logDao is always null ,so i can't persist my message in the database .
    Can someone help me with this dependecy injection issu ? (of course i've realized a component scan ...)
    Is there a way to tell Spring to realize the dependency injection before charging my custom appender ?
    thanks in advance !
    Code:
    @Service 
    public class HibernateAppenderDAO extends AppenderSkeleton{
      
      @Autowired
      @Qualifier ("logDao")
      LogDAO logDao ;
    
       @Override
       protected void append(LoggingEvent event) {
        // Code ...
        
         logDao.insert(ObjectToPersist);  //----> here my logDao is null , the problem come from here but i don't know how to tell spring to realize the dependency injection 
       }
    
    }
    Last edited by 4promachos; Jun 20th, 2012 at 03:21 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •