汎用Mapper環境ではmapperインタフェースに問題が注入できない

988 ワード

mapperインタフェースを書きました
package com.nyist.mapper;

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

public interface UserMapper extends Mapper {

}

サービスにこのインタフェースを注入--プロジェクトを起動し、エラーを報告しますか?
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
転載先:https://www.cnblogs.com/mzc1997/p/10227485.html