上一个回答的代码启动报错Error creating bean with name 'advertController' defined in file [E:\IdeaProjects\taihaolian\target\classes\com\ruifan\taihaolian\biz\controller\AdvertController.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'advertServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'advertMapper' defined in file [E:\IdeaProjects\taihaolian\target\classes\com\ruifan\taihaolian\biz\mapper\AdvertMapper.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 [tk/mybatis/mapper/autoconfigure/MapperAutoConfiguration.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: 'file [E:\IdeaProjects\taihaolian\target\classes\mapper\UserMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Could not find value method on SQL annotation. Cause: org.apache.ibatis.builder.BuilderException: Error creating SqlSource for SqlProvider. Method 'selectByRoleAndPage' not found in SqlProvider 'org.apache.ibatis.annotations.SelectProvider'.
时间: 2024-04-06 10:31:43 浏览: 175
Python中对错误NameError: name ‘xxx’ is not defined进行总结
5星 · 资源好评率100%
这是一个典型的 Spring 框架的错误,可能是由于依赖注入出现问题导致的。具体来说,可能是 advertController 类的构造函数中的参数注入失败,或者 advertServiceImpl 类中的依赖注入失败。而 advertMapper 类中的问题可能是由于找不到 SQL 注解中的 value 方法导致的。你可以检查一下相关的类和配置文件,看看是否有错误或遗漏的地方。
阅读全文