I'm pretty new to the whole idea of injecting beans, so speak slowly. :)
I've got a class that injects a bean, but when the property is accessed, the property is null and I get a null-pointer exception.
From /project-TRUNK/war-module/src/main/webapp/WEB-INF/spring-config/spring-bean.xml
<bean id="linkCheck"
class="com.dogwatch.util.LinkCheck">
<property name="linkDao" ref="jdbcLinkDao" />
</bean>
From /project-TRUNK/war-module/src/main/webapp/WEB-INF/spring-config/spring-dao.xml
<bean id="jdbcLinkDao" class="com.dogwatch.util.jdbcLinkDao">
<property name="dataSource" ref="dataSource" />
<property name="linkJdbcDataTypesSupport" ref="linkJdbcDataTypesSupport"/>
</bean>
The DAO bean is known to be good and works in several other classes.
package com.dogwatch.util;
public class LinkCheck {
private LinkDAO linkDao;
public LinkDAO getLinkDao() {
return linkDao;
}
public void setLinkDao(LinkDAO linkDao) {
this. linkDao = linkDao;
}
}
I've been comparing it to other classes that use the same DAO bean and I can't find any differences.
I do see the bean getting defined in:
INFO [2010-01-15 01:10:05,838] [main] [XmlBeanDefinitionReader] [XmlBeanDefinitionReader.java:323] - Loading XML bean definitions from URL [file:war-module/src/main/webapp/WEB-INF/spring-config/spring-dao.xml] INFO [2010-01-15 01:10:05,858] [main] [XmlBeanDefinitionReader] [XmlBeanDefinitionReader.java:323] - Loading XML bean definitions from URL [file:war-module/src/main/webapp/WEB-INF/spring-config/spring-bean.xml] INFO [2010-01-15 01:10:06,597] [main] [DefaultListableBeanFactory] [DefaultListableBeanFactory.java:414] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@3c01d5a0: defining beans [(snip) jdbcLinkDao, linkCheck(snip)businessLoggingAspect,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#1]; root of factory hierarchy
Does anyone have any suggestions on how to go about troubleshooting bean injection?