I would like to use org.apache.commons.logging in a class and have that log object created and injected into the target object
I want to set up this log using the spring app context. Is this possible and can anyone tell me what I need to change to get the above config to work.Code:import org.apache.commons.logging.Log class Foo { private Log log; public void setLog(Log inLog) { this.log = inLog; } ... other methods, etc. } spring config excerpt... <beans> <!-- use MethodInvokingFactoryBean to get a LogFactory?? --> <bean id="logFactory" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> <property name="targetClass"><value>org.apache.commons.logging.LogFactory</value></property> <property name="targetMethod"><value>getLog</value></property> </bean> <!-- use the LogFactory to get a Log object?? --> <bean id="logBean" class="org.apache.commons.logging.Log" factory-bean="logFactory"> <property name="targetMethod"><value>getLog</value></property> <property name="arguments"><value>com.availity.db.edi.AvEdiFecsSelector(sp)</value></property> </bean> <!-- the bean that receives the log bean --> <bean id="beanWithLog" class="com.compucafe.BeanWithLog"> <property name="log"><ref local="logBean"/> </bean> </beans>


Reply With Quote
