一、问题描述
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);
}
}
还没有评论,来说两句吧...