![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Spring
逸轩要冲鸭
这个作者很懒,什么都没留下…
展开
-
Spring中的常用链接
背景:由于工作忙,没时间写博客,见到好的博客直接放链接,方便以后查找下面这些帖子非常好一、Spring中Aware接口作用二、Spring中bean的生命周期原创 2022-02-24 23:38:30 · 461 阅读 · 0 评论 -
Spring中的aware接口
项目中经常出现循环注入,循环依赖问题,方式一:现在提供一个工具类,类用Spring中的aware实现获取bean对象import org.springframework.beans.BeansException;import org.springframework.context.ApplicationContext;import org.springframework.context.ApplicationContextAware;import org.springframework.lang原创 2022-02-18 21:52:18 · 401 阅读 · 0 评论 -
解决工具类中使用service为null 的方法
spring 或 springboot 的 websocket 里面使用 @Autowired 注入 service 或 bean 时,报空指针异常,service 为 null(并不是不能被注入)。解决方法:将要注入的 service 改成 static,就不会为null了。参考代码:@Componentpublic class ChatUtil {// 这里使用静态,让 service 属于类private static ChatService chatService;// 注入的时候,原创 2021-04-09 23:31:20 · 5526 阅读 · 4 评论 -
Spring IOC的底层实现原理
IOC:Inversion of Control 控制反转,指的是 对象的创建权反转(交给)给 Spring。作用是实现了程序的解耦合。原创 2021-04-04 15:22:15 · 262 阅读 · 0 评论