通用Mapper環境下,mapper接口無法注入問題


寫了一個mapper接口

package com.nyist.mapper;

import com.nyist.entity.User;
import tk.mybatis.mapper.common.Mapper;

public interface UserMapper extends Mapper<User> {

}

在Service中注入該接口--啟動項目,報錯一氣呵成😢

Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.nyist.mapper.UserMapper' available:Unsatisfied dependency expressed through field 'userMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.nyist.mapper.UserMapper' available:

查看springboot啟動類,

import tk.mybatis.spring.annotation.MapperScan;
@MapperScan("com.nyist.mapper")
.............

ok


免責聲明!

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



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM