具体错误如下:

  Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.thinkplatform.dao.UserLogDao' available: expected at least 1 bean which qualifies as autowire candidate. Dependency      annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

  经过排查发现在UserLogDaoImpl的实现类前面加个@Repository 就可以了

package com.thinkplatform.dao.impl;
import java.io.Serializable; import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.thinkplatform.dao.UserLogDao;
import com.thinkplatform.entity.UserLog; @Repository
public class UserLogDaoImpl extends SqlSessionDaoSupport implements UserLogDao{ public UserLogDaoImpl() {
this.ns = "UserLogMapper";
}
@Autowired
public void setSqlSessionfactory(SqlSessionFactory sqlSessionFactory) {
super.setSqlSessionFactory(sqlSessionFactory);
} //命名空间
private String ns; public String getNs(){
return this.ns;
} public void insert(UserLog userLog) {
this.getSqlSession().insert(ns+".insert",userLog);
} public void update(UserLog userLog) {
this.getSqlSession().update(ns+".update",userLog);
} public String get(Serializable id) {
return this.getSqlSession().selectOne(ns+".get",id);
} }

解决 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type的问题的更多相关文章

  1. Caused by:org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type "" available: expected at least 1 bean which qualifies as autowire candidate

    项目使用spring, mybatis.因为分了多个模块,所以会这个模块引用了其它模块的现在,结果使用Junit测试的时候发现有两个模块不能自动注入dao和service问题.解决后在此记录一下. 解 ...

  2. org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [dx.service.ItemService] found for dependency

    在整合ssm框架,测试service层的时候报错 Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: ...

  3. springboot 报错 org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type 'com.example.service.HrService' available: 有没有大佬出个主意,我找了一天,刚入门springboot

    话不多说先上图,这是启动类的配置,这里配置了@ComponentScan("我的mapper的接口") 接下来是我的项目结构截图 然后是service 的截图,我在这里加了注解@S ...

  4. 添加事务后 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type available

    今天遇到了一个奇怪的问题   在没添加事务之前  所有的代码都是好的 , 当我添加了事务之后, 代码报错 org.springframework.beans.factory.NoSuchBeanDef ...

  5. spring Boot异步操作报错误: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.self.spring.springboot.Jeep' available

    我也是最近开始学习Spring Boot,在执行异步操作的时候总是汇报如下的错误: Exception in thread "main" org.springframework.b ...

  6. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.qingmu.mybaitsplus.mapper.UserMapper' available:

    java.lang.IllegalStateException: Failed to load ApplicationContext at org.springframework.test.conte ...

  7. springboot启动报错:Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.zxkj.lockserver.dao.CompanyDao' available: expected at least 1 bean which qua

    Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of ty ...

  8. Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.thinkplatform.dao.UserLogDao' available: expected at least 1 bean which qualifies as autowi

    我出错的问题是: 检查:

  9. org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.oskyhang.gbd.service.UserService] found for dependency: expected at least 1 bean which qualifies as aut

    spring中一个符号的错误居然让我浪费了四五个小时才找出来,不得不给自己了两个耳光.. 由于新建项目与原来项目的目录结构有所不同,copy过来的配置文件,有些地方修改的不彻底,导致spring扫描注 ...

随机推荐

  1. Oracle 子查询和组函数练习

    SELECT * FROM emp; SELECT * FROM dept; 1.查询公司员工工资的最大值,最小值,平均值和总和. SELECT MAX(sal) AS 工资最大值, MIN(sal) ...

  2. 牛客网 牛客练习赛43 C.Tachibana Kanade Loves Review-最小生成树(并查集+Kruskal)+建虚点+读入挂

    链接:https://ac.nowcoder.com/acm/contest/548/C来源:牛客网 Tachibana Kanade Loves Review 时间限制:C/C++ 2秒,其他语言4 ...

  3. 转:win32下的堆管理系统

    转:https://bbs.pediy.com/thread-224136.htm 准备刷漏洞战争中的堆溢出部分,但是对于堆的了解较少,在这里记录一下关于堆的学习记录,有错误请各位大大拍砖 参考: & ...

  4. Python并发编程-事件,红绿灯控制

    事件用来控制多个进程同时执行或者阻塞 set和clear 分别用来修改一个事件的状态,True或者False is_set 用来查看一个事件的状态 wait 是依据事件的状态来决定自己是否在wait处 ...

  5. C# 找出实现某个接口的所有类

    该方法只能找实现某个接口的类,不能找继承某个抽象类的子类 var types = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => ...

  6. redis_安装

    前面几章内容简单介绍了NoSql的概念,以及NoSql的几种分类,本文开始后面开始学习KV数据库Redis. 一.Redis是什么? Redis:REmote DIctionary Server(远程 ...

  7. HDU 6118 度度熊的交易计划(费用流)

    [题目链接] http://acm.hdu.edu.cn/showproblem.php?pid=6118 [题目大意] 给出一张无向边权图,每个点最多可以生产b[i]商品,每件代价为a[i], 每个 ...

  8. lightoj 1296 - Again Stone Game 博弈论

    思路:由于数据很大,先通过打表找规律可以知道, 当n为偶数的时候其SG值为n/2; 当n为奇数的时候一直除2,直到为偶数m,则SG值为m/2; 代码如下: #include<stdio.h> ...

  9. 内功心法 -- java.util.LinkedList<E> (3)

    写在前面的话:读书破万卷,编码如有神--------------------------------------------------------------------下文主要对java.util ...

  10. [转]STRUTS2中的OGNL

    OGNL表达式是(Object-Graph Navigation Language)是对象图形化导航语言.OGNL是一个开源的项目,struts2中默认使用OGNL表达式语言来显示数据.与serlve ...