报错内容

Description:

Field userMapper in com.zxb.boot3.ssm.controller.UserController required a bean of type 'com.zxb.boot3.ssm.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.zxb.boot3.ssm.mapper.UserMapper' in your configuration.

解决方法

手动在启动类上添加 mapper 扫描

@SpringBootApplication
@MapperScan("com.zxb.boot3.ssm.mapper")
public class Boot305SsmApplication {
    public static void main(String[] args) {
        SpringApplication.run(Boot305SsmApplication.class, args);
    }
}

图片-dneqhals.png