![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring
spring学习笔记
四月丶丶
越努力越幸运
展开
-
Tomcat加载资源流程
资源配置spring和springmvc整合的时候资源加载入口配置在web.xml中,代码如下<web-app> <display-name>Archetype Created Web Application</display-name> <!--springioc容器管理bean及aop声明式事务配置文件--> <context-param> <param-name>contextCo原创 2020-07-19 11:50:48 · 274 阅读 · 0 评论 -
spring和springmvc父子容器
父子容器概念在spring和springmvc进行整合的时候,一般情况下我们会使用不同的配置文件来配置spring和springmvc,配置入口在web.xml文件,配置如下<web-app> <display-name>Archetype Created Web Application</display-name> <!--springioc容器管理bean及aop声明式事务配置文件--> <context-param原创 2020-07-19 11:09:50 · 170 阅读 · 0 评论 -
SpringIoc容器初始化流程
一. 核心方法概览二 、bean初始化总体流程 public void refresh() throws BeansException, IllegalStateException { synchronized (this.startupShutdownMonitor) { // Prepare this context for refreshing. // 准备更新上下文,设置开始时间,标记活动标志,初始化配置文件中的占位符 prepareRefresh();// Tell the原创 2020-07-18 10:38:09 · 450 阅读 · 0 评论 -
SpringIoc容器加载方式
1. 纯xml配置(beans信息定义全部在xml文件中)JavaSE://加载当前项目资源文件,常用ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");//加载系统文件,不方便迁移,不常用FileSystemXmlApplicationContext fileSystemXmlApplicationContext = new FileSystem原创 2020-07-18 10:34:51 · 115 阅读 · 0 评论 -
spring循环依赖时序图
原创 2020-07-18 10:15:45 · 228 阅读 · 1 评论 -
Spring-SpringMVC-JPA整合
整合策略SSM = Spring + SpringMVC + JPA= (Spring + JPA)+ SpringMVC先整合 Spring + JPA然后再整合 SpringMVCJPA整合Spring整合目标创建工程导入坐标(Java框架于我们而言就是一堆jar)配置 Spring 的配置文件(配置指定框架执行的细节)编写实体类 Resume,使用 JPA 注解配置映射关系编写一个符合 Spring Data JPA 的 Dao 层接口(ResumeDao接口)操作原创 2020-07-10 16:55:55 · 243 阅读 · 0 评论 -
Spring-SpringMVC-Mybatis整合
整合策略SSM = Spring + SpringMVC + Mybatis = (Spring + Mybatis)+ SpringMVC先整合 Spring + Mybatis然后再整合 SpringMVCMybatis整合Spring整合目标数据库连接池以及事务管理都交给Spring容器来完成SqlSessionFactory对象应该放到Spring容器中作为单例对象管理Mapper动态代理对象交给Spring管理,我们从Spring容器中直接获得Mapper的代理对象原创 2020-07-10 16:29:41 · 85 阅读 · 0 评论 -
@Async实现原理源码分析
终于到了源码分析的环节了,在这之前我已经写过了两篇文章专门分析这个@Async了,还没看过的同学先去看下哈。 不仅会用@Async,我把源码也梳理了一遍(上) 不仅会用@Async,我把源码也梳理了一遍(中) 好了,不啰嗦。分析过程: 开启异步代理 初始化excutor和exceptionHandler 定义切面处理 线程处理 开启异步化支持@EnableAsync@EnableAsync是开启某个模块的功能...转载 2020-07-04 12:23:44 · 766 阅读 · 0 评论 -
spring事务传播总结
事务传播机制场景:serviceA.methodA调用serviceB.methodB,A和B方法本 身都已经被添加了事务控制,那么A调用B的时候,就需要进行事务的一些协商传播级别是针对serviceB.methodB设置,serviceA.methodA保持默认即可,如果对A设置不当(SUPPORTS)当前事务还会失效,继而影响B的事务。同一个service中的方法互相调用,被调用方法事务不生效。spring事务是通过代理对象对方法增强来管理事务的,同一个service中通过一个方法调用另外一个原创 2020-07-01 13:43:49 · 365 阅读 · 4 评论