spring警告WARN o.m.s.m.ClassPathMapperScanner:44 restartedMain No MyBatis mapper was found in“xxx“

WARN o.m.s.m.ClassPathMapperScanner:44 restartedMain No MyBatis mapper was found in
原因,mapper扫描路径设置问题。

在配置文件“com.kmjiton.jiton_test.config.testApplication”中增加@MapperScan(“com.kmjiton.test.mapper”)

package com.kmjiton.test.config;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;

@SpringBootApplication
@ComponentScan("com.kmjiton")
@MapperScan("com.kmjiton.test.mapper")
public class testApplication {
	private static final Logger LOG = LoggerFactory.getLogger(testApplication.class);
	public static void main(String[] args) {
		SpringApplication app=new SpringApplication(testApplication.class);
		Environment env = (Environment) app.run(args).getEnvironment();
		LOG.info("启动成功!");
		LOG.info("地址:\thttp://127.0.0.1:{}", env.getProperty("server.port"));
	}

}

你可能感兴趣的:(mybatis,springboot)