Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required

博客内容讲述了在遇到Mybatis配置错误'Property 'sqlSessionFactory' or 'sqlSessionTemplate' are required'时,作者检查了pom.xml的依赖引用和mapper扫描配置,尝试了删除多余的@MapperScan或配置,但问题仍未解决。最终,通过对pom.xml的修改,成功消除了错误。博主对此进行了记录,以便他人参考。
摘要由CSDN通过智能技术生成

指向pom中对mybatis依赖的引用错误问题,或者是mapper扫描,数据源配置

参考链接https://blog.csdn.net/Roker_966/article/details/106822022

我有两个地方配置了mapper的路径

启动类加了@MapperScan

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@ComponentScan(basePackages = {"com.atguigu"})
@MapperScan("com.atguigu.educenter.mapper")
public class UcenterApplication {
    public static void main(String[] args) {
        SpringApplication.run(UcenterApplication.class,args);
    }
}

配置文件也加了

#配置mapper xml文件的路径
mybatis-plus.mapper-locations=classpath:com/atguigu/educenter/mapper/xml/*.xml

#mybatis日志
mybatis-plus.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl

删掉一处就可以了

但是,还是没能解决

我后来也改了pom.xml,成功不再报错了

 <dependencies>
        <dependency&g
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值