Consider defining a bean of type ‘com....mapper.SysUserMapper‘ in your configuration.

springboot项目创建常见问题(建议收藏!!)https://blog.csdn.net/libusi001/article/details/97267365

一、问题描述

Description:Parameter 0 of constructor in com.god.demo.app.service.impl.SysUserServiceImpl required a bean of type 'com.god.demo.app.dao.mapper.SysUserMapper' that could not be found.Action:Consider defining a bean of type 'com.god.demo.app.dao.mapper.SysUserMapper' in your configuration.Disconnected from the target VM, address: '127.0.0.1:63159', transport: 'socket'

二、创建文件MyBatisConfig

@MapperScan("com.xx.dao.mapper")
@Configuration
public class MyBatisConfig {@Beanpublic ConfigurationCustomizer configurationCustomizer() {return configuration -> {//驼峰命名法configuration.setMapUnderscoreToCamelCase(true);};}
}

三、或者直接

@MapperScan("com.xx.dao.mapper")
@SpringBootApplication
public class DemoApplication {public static void main(String[] args) {SpringApplication.run(DemoApplication.class, args);}}

 


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部