控制台打印错误如下
Caused by: java.lang.IllegalArgumentException: Property ‘sqlSessionFactory’ or ‘sqlSessionTemplate’ are required
springboot项目整合mybatis中mapper报错:
删除启动类@SpringBootApplication注解括号的数据库自动注解
package com.dongty;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.transaction.annotation.EnableTransactionManagement;
@SpringBootApplication()
@MapperScan("com.idea.mapper")
@EnableTransactionManagement
@EnableAspectJAutoProxy
public class Application {
public static void main(String[] args) {
SpringApplication.run(com.dongty.Application.class, args);
}
}