A component required a bean of type 'com.chun.zeroyuanlottery.mapper.MemberMapper' that could not be

651 ワード

Springbootを使用して環境を構築する場合、次のエラーが発生します.
A component required a bean of type ‘com.chun.zeroyuanlottery.mapper.MemberMapper’ that could not be found.
なぜならSpringBootはcomを認識できないからです.chun.zeroyuanlottery.mapper.MemberMapper. 以上の問題については、XXXXmapperに@Mapperが付いていないかどうかを確認する必要があります.もちろん、@Mapperが付いているmapperインタフェースを継承することで追加する必要はありません.そうしないと、エラーが発生します.
それ以外に、構成も考慮する必要があります.例えばSpringBoot 2.X:
mybatis:
    # type-aliases    
    # type-aliases-package:
    # mapper xml      
    mapper-locations: classpath:/mapper/*.xml