The specific errors are as follows:
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)}
After investigation, it is found that adding @ repository in front of the implementation class of userlogdaoimpl is OK
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);
}
}
Similar Posts:
- factory.NoSuchBeanDefinitionException: No qualifying bean of type
- mybatis: Property ‘configuration’ and ‘configLocation’ can not specified with together
- [Solved] Springboot startup error: org.springframework.beans.factory.unsatisfieddependenceexception…
- Exception encountered during context initialization – cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userDaoImpl’ defined in file
- [Solved] No qualifying bean of type ‘org.springframework.boot.orm.jpa.EntityManagerFactoryBuilder’ available:
- [Solved] expected single matching bean but found 2
- Cannot resolve reference to bean ‘entityManagerFactory’ while setting constructor argument
- [Solved] SpringbootExpection 1: Error creating bean with name ‘xxxImpl’: Unsatisfied dependency expressed through field
- Spring Boot Configure DataSource Using JNDI with Example
- Container Cannot Find bean, Field usersMapper in com.imooc.impl.UserServiceImpl required a bean of type ‘com.imooc.mapper.UsersMapper’ that could not be found.