1
I am configuring two Beans in the file beans.xml
to inject Loggers into my classes.
<bean id="loggerFactory" class="company.LoggerFactory" />
<bean id="logger" class="org.apache.log4j.Logger" factory-bean="loggerFactory" factory-method="createLogger" />
The setting makes the method LoggerFactory.createLogger
be called and this is working properly.
What I want to know is: how within this method, I get the class where the object will be injected to put it as logger name?
I’ve worked with CDI, and that’s why I asked this question. I know it’s possible that way, but in Spring I don’t know how to do.
– Renato Dinhani