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
}
}