摘要: 本篇主要集成Sping一个重要功能AOP 我们还是先回顾一下以前Spring中是如何使用AOP的,大家可以看看我这篇文章spring5 源码深度解析 AOP的使用及AOP自定义标签 Spring中使用AOP 引入Aspect <dependency> <groupId>org.aspectj</gr 阅读全文
posted @ 2019-11-27 11:39 chen_hao 阅读(3346) 评论(1) 推荐(3) 编辑
摘要: 本篇我们在SpringBoot中整合Mybatis这个orm框架,毕竟分析一下其自动配置的源码,我们先来回顾一下以前Spring中是如何整合Mybatis的,大家可以看看我这篇文章Mybaits 源码解析 (十) Spring-Mybatis框架使用与源码解析 Spring-Mybatis使用 添加 阅读全文
posted @ 2019-11-26 11:06 chen_hao 阅读(2461) 评论(0) 推荐(2) 编辑
摘要: 本篇来讲一下SpringBoot是怎么自动开启事务的,我们先来回顾一下以前SSM中是如何使用事务的 SSM使用事务 导入JDBC依赖包 众所周知,凡是需要跟数据库打交道的,基本上都要添加jdbc的依赖,在Spring项目中,加入的是spring-jdbc依赖: <dependency> <group 阅读全文
posted @ 2019-11-25 11:09 chen_hao 阅读(7198) 评论(0) 推荐(12) 编辑
摘要: 上一篇我们讲了SpringBoot中Tomcat的启动过程,本篇我们接着讲在SpringBoot中如何向Tomcat中添加Servlet、Filter、Listener 自定义Servlet、Filter、Listener Spring容器中声明ServletRegistrationBean、Fil 阅读全文
posted @ 2019-11-22 11:10 chen_hao 阅读(4220) 评论(1) 推荐(12) 编辑
摘要: Spring Boot默认使用Tomcat作为嵌入式的Servlet容器,只要引入了spring-boot-start-web依赖,则默认是用Tomcat作为Servlet容器: <dependency> <groupId>org.springframework.boot</groupId> <ar 阅读全文
posted @ 2019-11-21 11:13 chen_hao 阅读(4106) 评论(1) 推荐(8) 编辑
摘要: 在上一篇博客中分析了springBoot启动流程,大体的轮廓只是冰山一角。今天就来看一下springBoot的亮点功能:自动化装配功能。 先从@SpringBootApplication开始。在启动流程章节中,我们讲述了SpringBoot2大致的启动步骤,并进行了源码详解。但是在刷新容器这块并未展 阅读全文
posted @ 2019-11-20 11:20 chen_hao 阅读(4623) 评论(5) 推荐(4) 编辑
摘要: 在我们用 springboot 搭建项目的时候,有时候会碰到在项目启动时初始化一些操作的需求 ,针对这种需求 spring boot为我们提供了以下几种方案供我们选择: ApplicationRunner 与 CommandLineRunner 接口 Spring容器初始化时Initializing 阅读全文
posted @ 2019-11-18 11:18 chen_hao 阅读(6399) 评论(3) 推荐(8) 编辑
摘要: 本文从源代码的角度来看看Spring Boot的启动过程到底是怎么样的,为何以往纷繁复杂的配置到如今可以这么简便。 入口类 @SpringBootApplication public class HelloWorldMainApplication { public static void main( 阅读全文
posted @ 2019-11-15 11:04 chen_hao 阅读(27735) 评论(13) 推荐(50) 编辑
摘要: Spring Boot 概述 Build Anything with Spring Boot:Spring Boot is the starting point for building all Spring-based applications. Spring Boot is designed t 阅读全文
posted @ 2019-11-14 11:01 chen_hao 阅读(13019) 评论(0) 推荐(27) 编辑
摘要: 不知道一些同学有没有这种疑问,为什么Mybtis中要配置dataSource,Spring的事务中也要配置dataSource?那么Mybatis和Spring事务中用的Connection是同一个吗?我们常用配置如下 <!--会话工厂 --> <bean id="sqlSessionFactory 阅读全文
posted @ 2019-11-13 11:50 chen_hao 阅读(5068) 评论(0) 推荐(9) 编辑