Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required 问题解决
以下是报错日志
解决方案
确认以下配置是否都存在:
1、配置文件有写mybatis配置
2、启动类里加上Mapper扫描的注解(指向自己mapper存放的位置)
3、删除SpringBootApplication注解的exclude属性:
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class })
public class LovecardApplication {
public static void main(String[] args) {
SpringApplication.run(LovecardApplication.class, args);
}
}
中的SpringBootApplication注解改为
@SpringBootApplication
public class LovecardApplication {
public static void main(String[] args) {
SpringApplication.run(LovecardApplication.class, args);
}
}
再次启动
无报错
文章来源:https://blog.csdn.net/igray_xl/article/details/119347520