springboot项目创建常见问题(建议收藏!!)https://blog.csdn/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 {

    @Bean
    public 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);
    }

}

 

更多推荐

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