springboot+mybatisplus运行报错不能创建bean

重新框架的运行时报错,因为框架是自己拉来的 功能自己新加的加入mybatisplus之后运行报错

org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘restShiroFilterFactoryBean’ defined in class path resource [lb/lingbing/common/config/ShiroConfig.class]: Unsatisfied dependency expressed through method ‘restShiroFilterFactoryBean’ parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘securityManager’ defined in class path resource [lb/lingbing/common/config/ShiroConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.shiro.mgt.SecurityManager]: Factory method ‘securityManager’ threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userNameRealm’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘userService’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘userMapper’ defined in file [E:\zmq\瑞田\Shiro-RuiTian\target\classes\lb\lingbing\system\mapper\UserMapper.class]: Unsatisfied dependency expressed through bean property ‘sqlSessionFactory’; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sqlSessionFactory’ defined in class path resource [com/baomidou/mybatisplus/autoconfigure/MybatisPlusAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method ‘sqlSessionFactory’ threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: ‘class path resource [lb.lingbing.lingbingadd.mapper]’; nested exception is java.io.FileNotFoundException: class path resource [lb.lingbing.lingbingadd.mapper] cannot be opened because it does not exist

请添加图片描述
报错点是这里 经过发现是以为mapper没有映射到
我用的是springboot + mybatis plus 解决方法是在application的运行里加上注解请添加图片描述
加上第二个并对应相关的mapper包 完美解决

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
这个错误通常是由于未正确配置数据源(DataSource)引起的。在Spring Boot中使用MyBatis Plus时,你需要确保正确配置了数据源。 首先,确认你的应用程序中是否存在配置文件(如application.properties或application.yml)。在配置文件中,你需要指定数据库连接信息。 下面是一个示例的application.properties配置文件: ``` # 数据库连接信息 spring.datasource.url=jdbc:mysql://localhost:3306/mydatabase spring.datasource.username=username spring.datasource.password=password spring.datasource.driver-class-name=com.mysql.jdbc.Driver ``` 请确保以上配置中的数据库连接信息正确。 如果你已经正确配置了数据源信息,但仍然遇到该错误,可能是因为你没有正确引入数据源的依赖。在Spring Boot中,默认情况下,它会根据你的数据库连接信息自动配置数据源。但是,如果你使用的是非常规的数据源,或者想要手动配置数据源,你需要添加适当的依赖项。 如果你使用的是MySQL数据库,可以添加以下依赖项到你的pom.xml(Maven)或build.gradle(Gradle)文件中: ```xml <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> </dependency> ``` 如果你使用的是其他类型的数据库,请根据相应的数据库驱动程序添加适当的依赖项。 完成以上步骤后,重新启动你的应用程序,该错误应该会被解决。如果问题仍然存在,请检查日志文件以获取更详细的错误信息,以便进一步调试。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值