required a bean of type ‘com.xxx.xxx‘ that could not be found.错误

在编写MyBatis-Spring-Boot-Starter示例代码的时候遇到一个奇怪的问题,写了一个Mapper在Controller中使用@Autowire自动装载,却一直提示报错,找不到Mapper这个bean,错误信息如下:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-03-26 10:10:19.414 ERROR 17337 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

Field userMapper in com.reeson.learn.demo.controller.UserController required a bean of type 'com.reeson.learn.demo.mapper.UserMapper' that could not be found.

The injection point has the following annotations:
	- @org.springframework.beans.factory.annotation.Autowired(required=true)


Action:

Consider defining a bean of type 'com.reeson.learn.demo.mapper.UserMapper' in your configuration.

Disconnected from the target VM, address: '127.0.0.1:57324', transport: 'socket'

Process finished with exit code 1

google之后找到答案

@SpringBootApplication(scanBasePackages={
        "com.reeson.learn.demo.mapper"})

添加scanBasePackages之后问题解决

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
#ifndef __REQUIRED_RPCNDR_H_VERSION__ #define __REQUIRED_RPCNDR_H_VERSION__ 440 #endif #include "rpc.h" #include "rpcndr.h" #ifndef __RPCNDR_H_VERSION__ #error this stub requires an updated version of #endif // __RPCNDR_H_VERSION__ #ifndef COM_NO_WINDOWS_H #include "windows.h" #include "ole2.h" #endif /*COM_NO_WINDOWS_H*/ #ifndef __netcon_h__ #define __netcon_h__ /* Forward Declarations */ #ifndef __IEnumNetConnection_FWD_DEFINED__ #define __IEnumNetConnection_FWD_DEFINED__ typedef interface IEnumNetConnection IEnumNetConnection; #endif /* __IEnumNetConnection_FWD_DEFINED__ */ #ifndef __INetConnection_FWD_DEFINED__ #define __INetConnection_FWD_DEFINED__ typedef interface INetConnection INetConnection; #endif /* __INetConnection_FWD_DEFINED__ */ #ifndef __INetConnectionManager_FWD_DEFINED__ #define __INetConnectionManager_FWD_DEFINED__ typedef interface INetConnectionManager INetConnectionManager; #endif /* __INetConnectionManager_FWD_DEFINED__ */ #ifndef __INetConnectionConnectUi_FWD_DEFINED__ #define __INetConnectionConnectUi_FWD_DEFINED__ typedef interface INetConnectionConnectUi INetConnectionConnectUi; #endif /* __INetConnectionConnectUi_FWD_DEFINED__ */ #ifndef __INetConnectionPropertyUi_FWD_DEFINED__ #define __INetConnectionPropertyUi_FWD_DEFINED__ typedef interface INetConnectionPropertyUi INetConnectionPropertyUi; #endif /* __INetConnectionPropertyUi_FWD_DEFINED__ */ #ifndef __INetConnectionCommonUi_FWD_DEFINED__ #define __INetConnectionCommonUi_FWD_DEFINED__ typedef interface INetConnectionCommonUi INetConnectionCommonUi;

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值