原创 LinkedHashMap源碼分析及實現LRU算法

PS: 要先了解HashMap的實現原理HashMap源碼分析 一、簡單介紹 public class LinkedHashMap<K,V> extends HashMap<K,V> implements Map<K,V> 可

原创 一個NIO例子

例子完成的功能是,客戶端發送命令time到服務端,服務端返回當前時間給客戶端。 服務端邏輯代碼 public class MultiplexerTimeServerHandler implements Runnable {

原创 一個policy權限控制例子

首先在項目根目錄創建一個test.txt空文件,執行下面的代碼 public class JavaPolicyTest { public static void main(String[] args) throws IOExc

原创 幾個JMX的例子

參考文章: 開源框架是如何通過JMX來做監控的(一) - JMX簡介和Standard MBean 官網示例 一、StandardMBean 定義接口 public interface HelloMBean { publi

原创 MyBatis整合到Spring的原理

一、整合步驟 mybatis整合到spring一般配置如下 添加依賴 以maven爲例,在pom.xml中添加 <dependency> <groupId>org.mybatis</groupId>

原创 SpringBoot自動配置(二)-- 原理分析

SpringBoot自定義starter可參考:SpringBoot自動配置(一)-- 自定義starter SpringBoot啓動過程可參考:SpringBoot 啓動流程源碼筆記 SpringBoot啓動過程會創建應用上下文Ap

原创 SpringBoot自動配置(一)-- 自定義starter

一、創建自定義starter 先創建一個my-starter的module,主要配置依賴如下 <artifactId>my-starter</artifactId> <dependencies> <dependen

原创 Spring component-scan源碼分析(二) -- @Configuration註解處理

上篇文章Spring component-scan源碼分析(一) – XML解析分析了Spring解析<context:component-scan …/>標籤時,把掃描到的合適的類封裝成BeanDefinition加入Sping容器

原创 Spring component-scan源碼分析(三) -- @Autowired等註解的處理

相關筆記: Spring component-scan源碼分析(一) – XML解析 Spring component-scan源碼分析(二) – @Configuration註解處理 本篇文章分析注入註解(@Autowired、@V

原创 Spring的property-placeholder原理分析

一、解析封裝property-placeholder相關的BeanDefinition 有兩種方式: (1)在XML配置格式如下 <context:property-placeholder location="classpath*:

原创 Spring component-scan源碼分析(一)

在XML中配置component-scan通常如下 <context:component-scan base-package="xxx"> <context:exclude-filter type="annotation" ex

原创 MySQL InnoDB存儲引擎 之 鎖

MySQL InnoDB存儲引擎有七種鎖 自增鎖(Auto-inc Locks) 共享/排他鎖(Shared and Exclusive Locks) 意向鎖(Intention Locks) 插入意向鎖(Insert Intent

原创 MyBatis簡單分頁插件實現

插件類,繼承MyBatis的Interceptor 接口 原理分析可參考:MyBatis源碼筆記(八) – 插件實現原理 @Intercepts( @Signature(type = Executor.class,

原创 MyBatis源碼筆記(八) -- 插件實現原理

MyBatis的插件開發可參考:MyBatis簡單分頁插件實現 插件實現通過實現MyBatis提供的Interceptor接口 public interface Interceptor { //攔截執行 Object inter

原创 MyBatis源碼筆記(七) -- insert、update、delete語句的執行

首先要了解MyBatis如何動態代理接口的方法的,和JDBC基本編程 參考:MyBatis源碼筆記(四) – mapper動態代理 執行方法主要封裝在MapperMethod public class MapperMethod {