/p>
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
connectionURL="${spring.datasource.url}"
userId="${spring.datasource.username}"
password="${spring.datasource.password}">
spring boot 入口文件:
package com.mall.demo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@MapperScan(basePackages = "com.mall.demo.mapper")
public class MallProjectApplication {
public static void main(String[] args) {
SpringApplication.run(MallProjectApplication.class, args);
}
}
使用的编辑器是IDEA ,service实现类中使用Autowired注入,但运行 依然提示没有注入成功。
错误信息如下:
Description:
Field categoryMapper in com.mall.demo.service.impl.CategoryServiceImpl required a bean of type 'com.mall.demo.mapper.CategoryMapper' that could not be found.
Action:
Consider defining a bean of type 'com.mall.demo.mapper.CategoryMapper' in your configuration.