It doesn't seem to be working right now. I get a
java.lang.NullPointerException
I have a class that implements an interface
public class LearnerDao implements BaseDao {
private BaseDao dao;
public void setDao(BaseDao dao) {
this.dao=dao;
}
.
.
.
}
This is my wiring
<bean id="pm" factory-bean="pmf" factory-method="getPersistenceManager"
scope="prototype"></bean>
<bean id="learnerDao" class="com.hardwire.dao.impl.LearnerDao">
<property name="pm" ref="pm"></property>
</bean>
<bean id="twitterUserDao" class="com.hardwire.dao.impl.TwitterUserDao">
<property name="pm" ref="pm"></property>
</bean>
<bean id="learnerService" class="com.hardwire.service.LearnerService">
<property name="dao" ref="learnerDao"></property
</bean>
Here's my learnerService
public class LearnerService {
private static final Logger log =
Logger.getLogger(LearnerService.class.getName());
private BaseDao dao;
.
.
.
public void insert(Learner learner){
if (dao==null){
log.info("dao is null");
}
else {
log.info("dao is not null");
}
dao.insert(learner);
}
public void setDao(BaseDao dao) {
this.dao = dao;
}
It's only learnerDao that implements BaseDao. On the other hand, bean twitterUserDao does not. I'd like to note that twitterUserDao was injected just okay but learnerDao wasn't. The logs show that learnerDao is null. So I was wondering if this had anything to do with learnerDao implementing an inteface.