原因是在创建DAO对象时使用了 new xxxDaoImpl()的方法,直接使用注解或配置方式取对应的bean即可

如下:

WebApplicationContext beanFactory = WebApplicationContextUtils.getRequiredWebApplicationContext(sc);
        WriterLogDaowriterLogDao = (WriterLogDao) beanFactory.getBean("writerLogDao");

 或
 

/**
     * 短信发送日志DAO
     */
    @Resource(name = "mobile12580.WriterLogDao")
    private WriterLogDao writerLogDao;

 

"mobile12580.WriterLogDao"为WriterLogDaoImpl注入的名字