<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<properties resource="application.properties"/>
<context id="Mysql" targetRuntime="MyBatis3Simple" defaultModelType="flat">
<property name="beginningDelimiter" value="`"/>
<property name="endingDelimiter" value="`"/>
<!-- Mapper -->
<plugin type="tk.mybatis.mapper.generator.MapperPlugin">
<property name="mappers" value="com.mall.demo.util.MyMapper"/>
</plugin>
<jdbcConnection driverClass="${spring.datasource.driver-class-name}"
connectionURL="${spring.datasource.url}"
userId="${spring.datasource.username}"
password="${spring.datasource.password}">
</jdbcConnection>
<javaModelGenerator targetPackage="com.mall.demo.model" targetProject="src/main/java" >
<property name="enableSubPackages" value="true" />
</javaModelGenerator>
<sqlMapGenerator targetPackage="mapper" targetProject="src/main/resources">
<property name="enableSubPackages" value="true" />
</sqlMapGenerator>
<javaClientGenerator targetPackage="com.mall.demo.mapper" targetProject="src/main/java" type="XMLMAPPER">
<property name="enableSubPackages" value="true" />
</javaClientGenerator>
<table tableName="category">
<!--mysql -->
<!--<generatedKey column="id" sqlStatement="Mysql" identity="true"/>-->
<!--oracle -->
<!--<generatedKey column="id" sqlStatement="select SEQ_{1}.nextval from dual" identity="false" type="pre"/>-->
</table>
</context>
</generatorConfiguration>
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);
}
}
uses an editor that uses Autowired injection in the IDEA, service implementation class, but the run still indicates that the injection was not successful.
error message is as follows:
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.