springboot中Injection of resource dependencies failed

这篇具有很好参考价值的文章主要介绍了springboot中Injection of resource dependencies failed。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

问题一:无非就是注解的问题,业务实现类加@Service,映射类加@Mapper、启动类上加上@MapperScan(basePackages = "xxx.xxx")以及@Resouce和@Autowired的使用(IDEA中最好使用@Resouce,倒不是说@Autowired有错,但是会报波浪线或者爆红,虽然不影响运行),这类问题没什么好说的,自己看一下漏什么补什么。

问题二:

 @Resource
 XXXMapper xMapper;

 @Resource
 YYYMapper xMapper;

 或者

 @Autowired
 XXXMapper xMapper;

 @Autowired
 YYYMapper xMapper;

名字起相同了,无论是引入service还是mapper,都不要把别名起一样,这样也会报这样的错误。

问题三:由于springboot的版本,有些依赖于springboot版本不搭配,也会报错,比如mybatis-plus,mybatis暂时没发现有什么问题。解决办法就是降低springboot的版本咯,是3.x.x的降低到2.x.x,重启就好了。

问题三:依赖包引入错误的,无论是web的还是resouce注解等的依赖包,最好看清楚再引入,例如:

import jakarta.annotation.Resource;(错误的)
   和
import javax.annotation.Resource;(正确的)

两个相差不大,将这些玩意删除重新引入就可以了................................

问题四:application.yml或者application.properties中的:

配置mybatis或者mybatis-plus
mybatis:
  mapper-locations: classpath:mapper/*.xml(需检查处)
  type-aliases-package: com.jiayi.quanyi.pojo(需检查处)
  configuration:
    map-underscore-to-camel-case: true 

或

mybatis-plus:
  mapper-locations: classpath:/mapper/*.xml(需检查处)
  configuration:
    log-impl: xxxx.xxxxx  (需检查处)
    call-setters-on-nulls: true 

看一下路径是否填错之类的,需要与自己项目目录路径完全一致即可。

.................................................................

其他的应该也没什么大问题了,还有什么问题的可以评论区说一下文章来源地址https://www.toymoban.com/news/detail-775148.html

到了这里,关于springboot中Injection of resource dependencies failed的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Spring6-IoC(Inversion of Control)控制反转和DI(Dependency Injection)依赖注入,手动实现IOC

    Java 反射机制是在运行状态中,对于任意一个类,都能够知道这个类的所有属性和方法;对于任意一个对象,都能够调用它的任意方法和属性;这种动态获取信息以及动态调用对象方法的功能称为 Java 语言的 反射机制 。简单来说, 反射机制指的是程序在运行时能够获取自身

    2024年02月09日
    浏览(55)
  • 什么是依赖注入(Dependency Injection)?

    依赖注入(Dependency Injection,简称DI)是一种设计模式,用于实现类之间的解耦和依赖关系的管理。它通过将依赖关系的创建和维护责任转移到外部容器中,使得类不需要自己实例化依赖对象,而是由外部容器动态地注入依赖。 传统的对象创建方式往往由类自身负责创建和管

    2024年02月15日
    浏览(28)
  • Understanding Dependency Injection for angular

    Angular https://angular.io/guide/dependency-injection Denpendency Injection,  or DI, is one of fundamental concepts for angular, DI is writed by angular framework and allows classes with  Angular decorators,  such as Components, directives, Piples and Injectables , to configure dependencies that they need.  Two main roles exists in DI system: dependency

    2024年02月10日
    浏览(25)
  • ASP.NET Core 中的 Dependency injection

    依赖注入 (Dependency Injection,简称DI)是为了实现 各个类之间的依赖 的 控制反转 (Inversion of Control,简称IoC )。 ASP.NET Core 中的Controller 和 Service 或者其他类都支持依赖注入。 依赖注入术语中, Service 是一个为其他对象提供服务的类 **。 Service 不是一个Web Service,与Web Serv

    2024年02月11日
    浏览(25)
  • Angular 17+ 高级教程 – Dependency Injection 依赖注入

    本来是想先介绍 Angular Component 的,但 Component 里面会涉及到一些 Dependency Injection (简称 DI) 的概念,所以还是先介绍 DI 吧。 温馨提醒:如果你对 JS class、prototype 不太熟悉的话,建议你先看这篇 JavaScript – 理解 Object, Class, This, Prototype, Function, Mixins   首先我们有一个 class Ser

    2024年03月09日
    浏览(48)
  • Dependency Injection 8.0新功能——KeyedService

    本文只介绍 .NET Dependency Injection 8.0新功能——KeyedService,假定读者已熟练使用之前版本的功能。 8.0之前,注册一个类往往是 AddSingletonIFoo, Foo() ,8.0添加了一个新功能:“ 可以注册一个带Key的类 ” AddKeyedSingletonIFoo, Foo(\\\"keyA\\\") 。获取服务方法由 GetServiceIFoo() 变成了 GetKeyedServi

    2024年02月08日
    浏览(32)
  • Go 开源库运行时依赖注入框架 Dependency injection

    一个Go编程语言的运行依赖注入库。依赖注入是更广泛的控制反转技术的一种形式。它用于增加程序的模块化并使其具有可扩展性。 依赖注入是更广泛的控制反转技术的一种形式。它用于增加程序的模块化并使其具有可扩展性。 Providing Extraction Invocation Lazy-loading Interfaces Gro

    2024年02月07日
    浏览(42)
  • Angular(二) Understanding Dependency Injection for angular

    Angular https://angular.io/guide/dependency-injection Denpendency Injection,  or DI, is one of fundamental concepts for angular, DI is writed by angular framework and allows classes with  Angular decorators,  such as Components, directives, Piples and Injectables , to configure dependencies that they need.  Two main roles exists in DI system: dependency

    2024年02月09日
    浏览(29)
  • 【异常】Failed to load resource: the server responded with a status of 413 (Request Entity Too Large)

    经过查询,是因为应用服务器使用了Nginx做代理,而在Nginx这一层限制了上传文件的大小,因此需要修改Nginx配置 在location 下面增加 client_max_body_size 100M; 配置项,重启Nginx文件上传成功.

    2024年02月15日
    浏览(32)
  • Angular 17+ 高级教程 – Component 组件 の Dependency Injection & NodeInjector

    在 Dependency Injection 依赖注入 文章中,我们学习了 50% 的 Angular DI 知识,由于当时还不具备组件知识,所以我们无法完成另外 50% 的学习。 经过了几篇组件教程后,现在我们已经具备了基础的组件知识,那这一篇我们便来完成 Angular DI 所有内容吧。   Angular in Depth – A Deep

    2024年03月09日
    浏览(30)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包