解決 org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type的問題


  具體錯誤如下:

  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);
    }
    
}

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



猜您在找 org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type 'xxx 'available Caused by:org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type "" available: expected at least 1 bean which qualifies as autowire candidate org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)} org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'cn.yang.service.StudentInterface' available: expected at least 1 bean which qualifies as autowire candidate 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 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 spring 框架錯誤 org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type springboot 報錯 org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type 'com.example.service.HrService' available: 有沒有大佬出個主意,我找了一天,剛入門springboot spring Boot異步操作報錯誤: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.self.spring.springboot.Jeep' available org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'springSessionRepositoryFilter' is defined
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM