From d148fd31c5995c8db719294f49b0ce2c2a51c0d3 Mon Sep 17 00:00:00 2001 From: skywalker Date: 2018年10月17日 20:11:57 +0800 Subject: [PATCH 01/11] Update pom.xml --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index d4cda3d..68ddf1d 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ http://maven.apache.org UTF-8 - 4.3.2.RELEASE + 4.3.18 @@ -90,7 +90,7 @@ com.fasterxml.jackson.core jackson-databind - 2.5.3 + 2.8.11.1 From 6434e4deb62283cdf342fcee9af6e262bed95334 Mon Sep 17 00:00:00 2001 From: seaswalker Date: 2018年11月19日 11:19:31 +0800 Subject: [PATCH 02/11] upgrade pom --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 68ddf1d..9152dfd 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ http://maven.apache.org UTF-8 - 4.3.18 + 4.3.18.RELEASE @@ -90,7 +90,7 @@ com.fasterxml.jackson.core jackson-databind - 2.8.11.1 + 2.9.0 From bb7a2c624f6f2799548846fe0385ccd170c41477 Mon Sep 17 00:00:00 2001 From: seaswalker Date: 2018年11月19日 11:20:32 +0800 Subject: [PATCH 03/11] upgrade pom --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 9152dfd..4722752 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.0 + 2.9.5 From ed4ee98341b8a59c025d2f101fc691a25ff6dfee Mon Sep 17 00:00:00 2001 From: skywalker Date: 2019年1月29日 10:54:29 +0800 Subject: [PATCH 04/11] Update pom.xml --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 4722752..3992b4c 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.5 + 2.9.8 From 57cc3aaa5d209302b2cee24ff8f81a25e4a90794 Mon Sep 17 00:00:00 2001 From: qqq19923 <18718185869@163.com> Date: 2019年2月18日 15:51:54 +0800 Subject: [PATCH 05/11] add Table of Contents --- note/Spring.md | 102 +++++++++++++++++++++++++++ note/guava-cache.md | 34 +++++++++ note/spring-aop.md | 77 +++++++++++++++++++++ note/spring-boot.md | 22 ++++++ note/spring-context.md | 137 +++++++++++++++++++++++++++++++++++++ note/spring-mvc.md | 70 +++++++++++++++++++ note/spring-task.md | 24 +++++++ note/spring-transaction.md | 34 +++++++++ 8 files changed, 500 insertions(+) diff --git a/note/Spring.md b/note/Spring.md index 6424696..0d04abd 100644 --- a/note/Spring.md +++ b/note/Spring.md @@ -1,3 +1,105 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [基本](#%E5%9F%BA%E6%9C%AC) + - [ClassPathXmlApplicationContext](#classpathxmlapplicationcontext) + - [构造器](#%E6%9E%84%E9%80%A0%E5%99%A8) + - [设置配置文件路径](#%E8%AE%BE%E7%BD%AE%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%B7%AF%E5%BE%84) + - [Environment接口](#environment%E6%8E%A5%E5%8F%A3) + - [Profile](#profile) + - [Property](#property) + - [Environment构造器](#environment%E6%9E%84%E9%80%A0%E5%99%A8) + - [PropertySources接口](#propertysources%E6%8E%A5%E5%8F%A3) + - [PropertySource接口](#propertysource%E6%8E%A5%E5%8F%A3) + - [路径Placeholder处理](#%E8%B7%AF%E5%BE%84placeholder%E5%A4%84%E7%90%86) + - [PropertyResolver接口](#propertyresolver%E6%8E%A5%E5%8F%A3) + - [解析](#%E8%A7%A3%E6%9E%90) + - [refresh](#refresh) + - [prepareRefresh](#preparerefresh) + - [属性校验](#%E5%B1%9E%E6%80%A7%E6%A0%A1%E9%AA%8C) + - [BeanFactory创建](#beanfactory%E5%88%9B%E5%BB%BA) + - [BeanFactory接口](#beanfactory%E6%8E%A5%E5%8F%A3) + - [BeanFactory定制](#beanfactory%E5%AE%9A%E5%88%B6) + - [Bean加载](#bean%E5%8A%A0%E8%BD%BD) + - [EntityResolver](#entityresolver) + - [BeanDefinitionReader](#beandefinitionreader) + - [路径解析(Ant)](#%E8%B7%AF%E5%BE%84%E8%A7%A3%E6%9E%90ant) + - [配置文件加载](#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%8A%A0%E8%BD%BD) + - [Bean解析](#bean%E8%A7%A3%E6%9E%90) + - [默认命名空间解析](#%E9%BB%98%E8%AE%A4%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E8%A7%A3%E6%9E%90) + - [import](#import) + - [alias](#alias) + - [bean](#bean) + - [id & name处理](#id--name%E5%A4%84%E7%90%86) + - [beanName生成](#beanname%E7%94%9F%E6%88%90) + - [bean解析](#bean%E8%A7%A3%E6%9E%90) + - [Bean装饰](#bean%E8%A3%85%E9%A5%B0) + - [Bean注册](#bean%E6%B3%A8%E5%86%8C) + - [BeanDefiniton数据结构](#beandefiniton%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84) + - [beans](#beans) + - [其它命名空间解析](#%E5%85%B6%E5%AE%83%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E8%A7%A3%E6%9E%90) + - [NamespaceHandler继承体系](#namespacehandler%E7%BB%A7%E6%89%BF%E4%BD%93%E7%B3%BB) + - [init](#init) + - [BeanFactory数据结构](#beanfactory%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84) + - [prepareBeanFactory](#preparebeanfactory) + - [BeanExpressionResolver](#beanexpressionresolver) + - [PropertyEditorRegistrar](#propertyeditorregistrar) + - [环境注入](#%E7%8E%AF%E5%A2%83%E6%B3%A8%E5%85%A5) + - [依赖解析忽略](#%E4%BE%9D%E8%B5%96%E8%A7%A3%E6%9E%90%E5%BF%BD%E7%95%A5) + - [bean伪装](#bean%E4%BC%AA%E8%A3%85) + - [LoadTimeWeaver](#loadtimeweaver) + - [注册环境](#%E6%B3%A8%E5%86%8C%E7%8E%AF%E5%A2%83) + - [postProcessBeanFactory](#postprocessbeanfactory) + - [invokeBeanFactoryPostProcessors](#invokebeanfactorypostprocessors) + - [BeanPostProcessor注册](#beanpostprocessor%E6%B3%A8%E5%86%8C) + - [MessageSource](#messagesource) + - [事件驱动](#%E4%BA%8B%E4%BB%B6%E9%A9%B1%E5%8A%A8) + - [事件](#%E4%BA%8B%E4%BB%B6) + - [发布者](#%E5%8F%91%E5%B8%83%E8%80%85) + - [ApplicationEventPublisher](#applicationeventpublisher) + - [ApplicationEventMulticaster](#applicationeventmulticaster) + - [监听器](#%E7%9B%91%E5%90%AC%E5%99%A8) + - [初始化](#%E5%88%9D%E5%A7%8B%E5%8C%96) + - [事件发布](#%E4%BA%8B%E4%BB%B6%E5%8F%91%E5%B8%83) + - [监听器获取](#%E7%9B%91%E5%90%AC%E5%99%A8%E8%8E%B7%E5%8F%96) + - [同步/异步](#%E5%90%8C%E6%AD%A5%E5%BC%82%E6%AD%A5) + - [全局](#%E5%85%A8%E5%B1%80) + - [注解](#%E6%B3%A8%E8%A7%A3) + - [onRefresh](#onrefresh) + - [ApplicationListener注册](#applicationlistener%E6%B3%A8%E5%86%8C) + - [singleton初始化](#singleton%E5%88%9D%E5%A7%8B%E5%8C%96) + - [ConversionService](#conversionservice) + - [StringValueResolver](#stringvalueresolver) + - [LoadTimeWeaverAware](#loadtimeweaveraware) + - [初始化](#%E5%88%9D%E5%A7%8B%E5%8C%96-1) +- [getBean](#getbean) + - [beanName转化](#beanname%E8%BD%AC%E5%8C%96) + - [手动注册bean检测](#%E6%89%8B%E5%8A%A8%E6%B3%A8%E5%86%8Cbean%E6%A3%80%E6%B5%8B) + - [检查父容器](#%E6%A3%80%E6%9F%A5%E7%88%B6%E5%AE%B9%E5%99%A8) + - [依赖初始化](#%E4%BE%9D%E8%B5%96%E5%88%9D%E5%A7%8B%E5%8C%96) + - [Singleton初始化](#singleton%E5%88%9D%E5%A7%8B%E5%8C%96) + - [getSingleton方法](#getsingleton%E6%96%B9%E6%B3%95) + - [是否存在](#%E6%98%AF%E5%90%A6%E5%AD%98%E5%9C%A8) + - [bean创建](#bean%E5%88%9B%E5%BB%BA) + - [lookup-method检测](#lookup-method%E6%A3%80%E6%B5%8B) + - [InstantiationAwareBeanPostProcessor触发](#instantiationawarebeanpostprocessor%E8%A7%A6%E5%8F%91) + - [doCreateBean](#docreatebean) + - [创建(createBeanInstance)](#%E5%88%9B%E5%BB%BAcreatebeaninstance) + - [MergedBeanDefinitionPostProcessor](#mergedbeandefinitionpostprocessor) + - [属性解析](#%E5%B1%9E%E6%80%A7%E8%A7%A3%E6%9E%90) + - [属性设置](#%E5%B1%9E%E6%80%A7%E8%AE%BE%E7%BD%AE) + - [初始化](#%E5%88%9D%E5%A7%8B%E5%8C%96-2) + - [getObjectForBeanInstance](#getobjectforbeaninstance) + - [Prototype初始化](#prototype%E5%88%9D%E5%A7%8B%E5%8C%96) + - [beforePrototypeCreation](#beforeprototypecreation) + - [createBean](#createbean) + - [afterPrototypeCreation](#afterprototypecreation) + - [总结](#%E6%80%BB%E7%BB%93) + - [其它Scope初始化](#%E5%85%B6%E5%AE%83scope%E5%88%9D%E5%A7%8B%E5%8C%96) + + + # 基本 本部分从最基本的Spring开始。配置文件: diff --git a/note/guava-cache.md b/note/guava-cache.md index e9ed021..f729c2f 100644 --- a/note/guava-cache.md +++ b/note/guava-cache.md @@ -1,3 +1,37 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [创建](#%E5%88%9B%E5%BB%BA) + - [数据结构](#%E6%95%B0%E6%8D%AE%E7%BB%93%E6%9E%84) + - [segments](#segments) + - [ReferenceEntry](#referenceentry) + - [初始化](#%E5%88%9D%E5%A7%8B%E5%8C%96) + - [ReferenceEntry数组](#referenceentry%E6%95%B0%E7%BB%84) + - [引用队列](#%E5%BC%95%E7%94%A8%E9%98%9F%E5%88%97) +- [put](#put) + - [Hash算法](#hash%E7%AE%97%E6%B3%95) + - [ReHash](#rehash) + - [Segment选取](#segment%E9%80%89%E5%8F%96) + - [Segment.put](#segmentput) + - [线程安全性](#%E7%BA%BF%E7%A8%8B%E5%AE%89%E5%85%A8%E6%80%A7) + - [过期/垃圾缓存清理](#%E8%BF%87%E6%9C%9F%E5%9E%83%E5%9C%BE%E7%BC%93%E5%AD%98%E6%B8%85%E7%90%86) + - [垃圾缓存](#%E5%9E%83%E5%9C%BE%E7%BC%93%E5%AD%98) + - [善后](#%E5%96%84%E5%90%8E) + - [writeQueue移除](#writequeue%E7%A7%BB%E9%99%A4) + - [accessQueue移除](#accessqueue%E7%A7%BB%E9%99%A4) + - [加载终止](#%E5%8A%A0%E8%BD%BD%E7%BB%88%E6%AD%A2) + - [移除算法](#%E7%A7%BB%E9%99%A4%E7%AE%97%E6%B3%95) + - [过期缓存](#%E8%BF%87%E6%9C%9F%E7%BC%93%E5%AD%98) + - [扩容](#%E6%89%A9%E5%AE%B9) + - [设值](#%E8%AE%BE%E5%80%BC) +- [get(key)](#getkey) + - [get(key,hash,loader)](#getkeyhashloader) +- [参考](#%E5%8F%82%E8%80%83) +- [总结](#%E6%80%BB%E7%BB%93) + + + # 创建 以CacheLoader的方式为例: diff --git a/note/spring-aop.md b/note/spring-aop.md index 0a6db04..4a6d4da 100644 --- a/note/spring-aop.md +++ b/note/spring-aop.md @@ -1,3 +1,80 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [开头](#%E5%BC%80%E5%A4%B4) +- [aop:config](#aopconfig) + - [解析](#%E8%A7%A3%E6%9E%90) + - [proxy-target-class & expose-proxy](#proxy-target-class--expose-proxy) + - [aop:pointcut](#aoppointcut) + - [aop:advisor](#aopadvisor) + - [aop:aspect](#aopaspect) + - [aop:declare-parents](#aopdeclare-parents) + - [其它](#%E5%85%B6%E5%AE%83) + - [MethodLocatingFactoryBean](#methodlocatingfactorybean) + - [SimpleBeanFactoryAwareAspectInstanceFactory](#simplebeanfactoryawareaspectinstancefactory) + - [总结](#%E6%80%BB%E7%BB%93) + - [代理子类生成](#%E4%BB%A3%E7%90%86%E5%AD%90%E7%B1%BB%E7%94%9F%E6%88%90) + - [入口](#%E5%85%A5%E5%8F%A3) + - [postProcessBeforeInstantiation](#postprocessbeforeinstantiation) + - [调用时机](#%E8%B0%83%E7%94%A8%E6%97%B6%E6%9C%BA) + - [源码](#%E6%BA%90%E7%A0%81) + - [应该代理 ?](#%E5%BA%94%E8%AF%A5%E4%BB%A3%E7%90%86-) + - [基础类检测](#%E5%9F%BA%E7%A1%80%E7%B1%BB%E6%A3%80%E6%B5%8B) + - [跳过类检测](#%E8%B7%B3%E8%BF%87%E7%B1%BB%E6%A3%80%E6%B5%8B) + - [AOP逻辑](#aop%E9%80%BB%E8%BE%91) + - [Advisor寻找](#advisor%E5%AF%BB%E6%89%BE) + - [适用性检测](#%E9%80%82%E7%94%A8%E6%80%A7%E6%A3%80%E6%B5%8B) + - [检测结果缓存](#%E6%A3%80%E6%B5%8B%E7%BB%93%E6%9E%9C%E7%BC%93%E5%AD%98) + - [TargetSource](#targetsource) + - [postProcessAfterInitialization](#postprocessafterinitialization) + - [Advisor寻找](#advisor%E5%AF%BB%E6%89%BE-1) + - [适用性判断](#%E9%80%82%E7%94%A8%E6%80%A7%E5%88%A4%E6%96%AD) + - [引入](#%E5%BC%95%E5%85%A5) + - [其它](#%E5%85%B6%E5%AE%83-1) + - [Advisor扩展](#advisor%E6%89%A9%E5%B1%95) + - [排序](#%E6%8E%92%E5%BA%8F) + - [创建](#%E5%88%9B%E5%BB%BA) + - [JDK动态代理 or Cglib](#jdk%E5%8A%A8%E6%80%81%E4%BB%A3%E7%90%86-or-cglib) + - [JDK动态代理](#jdk%E5%8A%A8%E6%80%81%E4%BB%A3%E7%90%86) + - [equals & hashCode](#equals--hashcode) + - [链式调用](#%E9%93%BE%E5%BC%8F%E8%B0%83%E7%94%A8) + - [Cglib](#cglib) +- [aop:scoped-proxy](#aopscoped-proxy) + - [解析](#%E8%A7%A3%E6%9E%90-1) + - [入口](#%E5%85%A5%E5%8F%A3-1) + - [装饰](#%E8%A3%85%E9%A5%B0) + - [代理生成](#%E4%BB%A3%E7%90%86%E7%94%9F%E6%88%90) + - [Advisor](#advisor) + - [引入](#%E5%BC%95%E5%85%A5-1) + - [例子](#%E4%BE%8B%E5%AD%90) + - [自定义Scope](#%E8%87%AA%E5%AE%9A%E4%B9%89scope) + - [配置](#%E9%85%8D%E7%BD%AE) + - [测试](#%E6%B5%8B%E8%AF%95) + - [原理](#%E5%8E%9F%E7%90%86) + - [doGetBean](#dogetbean) + - [代理子类](#%E4%BB%A3%E7%90%86%E5%AD%90%E7%B1%BB) + - [CallbackFilter & Callback](#callbackfilter--callback) + - [Callback](#callback) + - [CallbackFilter](#callbackfilter) + - [回调](#%E5%9B%9E%E8%B0%83) +- [aop:aspectj-autoproxy](#aopaspectj-autoproxy) + - [属性](#%E5%B1%9E%E6%80%A7) + - [proxy-target-class](#proxy-target-class) + - [expose-proxy](#expose-proxy) + - [栗子](#%E6%A0%97%E5%AD%90) + - [切面](#%E5%88%87%E9%9D%A2) + - [被代理类](#%E8%A2%AB%E4%BB%A3%E7%90%86%E7%B1%BB) + - [配置](#%E9%85%8D%E7%BD%AE-1) + - [解析](#%E8%A7%A3%E6%9E%90-2) + - [原理](#%E5%8E%9F%E7%90%86-1) + - [总结](#%E6%80%BB%E7%BB%93-1) +- [拾遗](#%E6%8B%BE%E9%81%97) + - [AOP切面的坑](#aop%E5%88%87%E9%9D%A2%E7%9A%84%E5%9D%91) + - [总结](#%E6%80%BB%E7%BB%93-2) + + + # 开头 aop部分的解析器由AopNamespaceHandler注册,其init方法: diff --git a/note/spring-boot.md b/note/spring-boot.md index c30c11e..0993d3b 100644 --- a/note/spring-boot.md +++ b/note/spring-boot.md @@ -1,3 +1,25 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [SpringApplication](#springapplication) + - [web环境检测](#web%E7%8E%AF%E5%A2%83%E6%A3%80%E6%B5%8B) + - [ApplicationContextInitializer](#applicationcontextinitializer) + - [ApplicationListener](#applicationlistener) + - [SpringApplicationRunListener](#springapplicationrunlistener) +- [run](#run) + - [starting](#starting) + - [环境准备](#%E7%8E%AF%E5%A2%83%E5%87%86%E5%A4%87) + - [属性来源](#%E5%B1%9E%E6%80%A7%E6%9D%A5%E6%BA%90) + - [profile配置](#profile%E9%85%8D%E7%BD%AE) + - [environmentPrepared](#environmentprepared) + - [配置文件加载](#%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E5%8A%A0%E8%BD%BD) + - [SpringApplicationJsonEnvironmentPostProcessor](#springapplicationjsonenvironmentpostprocessor) + - [CloudFoundryVcapEnvironmentPostProcessor](#cloudfoundryvcapenvironmentpostprocessor) + - [ConfigFileApplicationListener](#configfileapplicationlistener) + + + # SpringApplication 启动程序首先初始化了一个SpringApplication对象。来看一看在它的构造器了发生了什么。 diff --git a/note/spring-context.md b/note/spring-context.md index 585e539..fec3dcc 100644 --- a/note/spring-context.md +++ b/note/spring-context.md @@ -1,3 +1,140 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [开头](#%E5%BC%80%E5%A4%B4) +- [annotation-config](#annotation-config) + - [BeanPostProcessor注册](#beanpostprocessor%E6%B3%A8%E5%86%8C) + - [AnnotationAwareOrderComparator](#annotationawareordercomparator) + - [ContextAnnotationAutowireCandidateResolver](#contextannotationautowirecandidateresolver) + - [ConfigurationClassPostProcessor](#configurationclasspostprocessor) + - [AutowiredAnnotationBeanPostProcessor](#autowiredannotationbeanpostprocessor) + - [RequiredAnnotationBeanPostProcessor](#requiredannotationbeanpostprocessor) + - [CommonAnnotationBeanPostProcessor](#commonannotationbeanpostprocessor) + - [PersistenceAnnotationBeanPostProcessor](#persistenceannotationbeanpostprocessor) + - [EventListenerMethodProcessor](#eventlistenermethodprocessor) + - [DefaultEventListenerFactory](#defaulteventlistenerfactory) + - [逻辑关系整理](#%E9%80%BB%E8%BE%91%E5%85%B3%E7%B3%BB%E6%95%B4%E7%90%86) + - [运行](#%E8%BF%90%E8%A1%8C) + - [ConfigurationClassPostProcessor](#configurationclasspostprocessor-1) + - [postProcessBeanDefinitionRegistry](#postprocessbeandefinitionregistry) + - [BeanPostProcessor注册](#beanpostprocessor%E6%B3%A8%E5%86%8C-1) + - [ImportAwareBeanPostProcessor](#importawarebeanpostprocessor) + - [EnhancedConfigurationBeanPostProcessor](#enhancedconfigurationbeanpostprocessor) + - [类解析](#%E7%B1%BB%E8%A7%A3%E6%9E%90) + - [bean名字生成策略](#bean%E5%90%8D%E5%AD%97%E7%94%9F%E6%88%90%E7%AD%96%E7%95%A5) + - [postProcessBeanFactory](#postprocessbeanfactory) + - [AutowiredAnnotationBeanPostProcessor](#autowiredannotationbeanpostprocessor-1) + - [postProcessMergedBeanDefinition](#postprocessmergedbeandefinition) + - [入口](#%E5%85%A5%E5%8F%A3) + - [源码](#%E6%BA%90%E7%A0%81) + - [变量扫描](#%E5%8F%98%E9%87%8F%E6%89%AB%E6%8F%8F) + - [方法扫描](#%E6%96%B9%E6%B3%95%E6%89%AB%E6%8F%8F) + - [bridge方法](#bridge%E6%96%B9%E6%B3%95) + - [PropertyDescriptor](#propertydescriptor) + - [postProcessPropertyValues](#postprocesspropertyvalues) + - [入口](#%E5%85%A5%E5%8F%A3-1) + - [注入](#%E6%B3%A8%E5%85%A5) + - [Field注入](#field%E6%B3%A8%E5%85%A5) + - [方法注入](#%E6%96%B9%E6%B3%95%E6%B3%A8%E5%85%A5) + - [RequiredAnnotationBeanPostProcessor](#requiredannotationbeanpostprocessor-1) + - [postProcessMergedBeanDefinition](#postprocessmergedbeandefinition-1) + - [postProcessPropertyValues](#postprocesspropertyvalues-1) + - [结果缓存](#%E7%BB%93%E6%9E%9C%E7%BC%93%E5%AD%98) + - [PropertyDescriptor](#propertydescriptor-1) + - [测试](#%E6%B5%8B%E8%AF%95) + - [CommonAnnotationBeanPostProcessor](#commonannotationbeanpostprocessor-1) + - [postProcessMergedBeanDefinition](#postprocessmergedbeandefinition-2) + - [父类](#%E7%88%B6%E7%B1%BB) + - [子类](#%E5%AD%90%E7%B1%BB) + - [postProcessPropertyValues](#postprocesspropertyvalues-2) + - [postProcessBeforeInitialization](#postprocessbeforeinitialization) + - [postProcessBeforeDestruction](#postprocessbeforedestruction) + - [EventListenerMethodProcessor](#eventlistenermethodprocessor-1) + - [入口](#%E5%85%A5%E5%8F%A3-2) + - [源码](#%E6%BA%90%E7%A0%81-1) +- [component-scan](#component-scan) + - [初始化](#%E5%88%9D%E5%A7%8B%E5%8C%96) + - [use-default-filters](#use-default-filters) + - [扫描器:创建 & 初始化](#%E6%89%AB%E6%8F%8F%E5%99%A8%E5%88%9B%E5%BB%BA--%E5%88%9D%E5%A7%8B%E5%8C%96) + - [resource-pattern](#resource-pattern) + - [name-generator](#name-generator) + - [scope-resolver](#scope-resolver) + - [scoped-proxy](#scoped-proxy) + - [exclude-filter/include-filter](#exclude-filterinclude-filter) + - [annotation-config](#annotation-config-1) + - [扫描](#%E6%89%AB%E6%8F%8F) + - [逐包扫描/BeanDefinition解析](#%E9%80%90%E5%8C%85%E6%89%AB%E6%8F%8Fbeandefinition%E8%A7%A3%E6%9E%90) + - [@Scope解析](#scope%E8%A7%A3%E6%9E%90) + - [bean名字生成](#bean%E5%90%8D%E5%AD%97%E7%94%9F%E6%88%90) + - [根据注解](#%E6%A0%B9%E6%8D%AE%E6%B3%A8%E8%A7%A3) + - [默认策略](#%E9%BB%98%E8%AE%A4%E7%AD%96%E7%95%A5) + - [其它注解解析](#%E5%85%B6%E5%AE%83%E6%B3%A8%E8%A7%A3%E8%A7%A3%E6%9E%90) + - [冲突检测](#%E5%86%B2%E7%AA%81%E6%A3%80%E6%B5%8B) + - [代理生成](#%E4%BB%A3%E7%90%86%E7%94%9F%E6%88%90) + - [BeanDefinition注册](#beandefinition%E6%B3%A8%E5%86%8C) + - [Component注册](#component%E6%B3%A8%E5%86%8C) +- [property-override](#property-override) + - [作用](#%E4%BD%9C%E7%94%A8) + - [类图](#%E7%B1%BB%E5%9B%BE) + - [解析](#%E8%A7%A3%E6%9E%90) + - [properties-ref](#properties-ref) + - [order](#order) + - [ignore-resource-not-found](#ignore-resource-not-found) + - [ignore-unresolvable](#ignore-unresolvable) + - [local-override](#local-override) + - [BeanDefinition](#beandefinition) + - [运行](#%E8%BF%90%E8%A1%8C-1) + - [属性加载](#%E5%B1%9E%E6%80%A7%E5%8A%A0%E8%BD%BD) + - [属性转换](#%E5%B1%9E%E6%80%A7%E8%BD%AC%E6%8D%A2) + - [属性设置](#%E5%B1%9E%E6%80%A7%E8%AE%BE%E7%BD%AE) +- [property-placeholder](#property-placeholder) + - [解析](#%E8%A7%A3%E6%9E%90-1) + - [system-properties-mode](#system-properties-mode) + - [value-separator](#value-separator) + - [null-value](#null-value) + - [trim-values](#trim-values) + - [BeanDefinition](#beandefinition-1) + - [运行](#%E8%BF%90%E8%A1%8C-2) + - [处理](#%E5%A4%84%E7%90%86) +- [load-time-weaver & spring-configured](#load-time-weaver--spring-configured) + - [javaagent](#javaagent) + - [解析](#%E8%A7%A3%E6%9E%90-2) + - [LoadTimeWeaver](#loadtimeweaver) + - [LoadTimeWeaverBeanDefinitionParser](#loadtimeweaverbeandefinitionparser) + - [aspectj-weaving](#aspectj-weaving) + - [是否开启](#%E6%98%AF%E5%90%A6%E5%BC%80%E5%90%AF) + - [AspectJWeavingEnabler](#aspectjweavingenabler) + - [SpringConfiguredBeanDefinitionParser](#springconfiguredbeandefinitionparser) + - [切点(pointcut)](#%E5%88%87%E7%82%B9pointcut) + - [inConfigurableBean](#inconfigurablebean) + - [beanConstruction](#beanconstruction) + - [preConstructionCondition](#preconstructioncondition) + - [leastSpecificSuperTypeConstruction](#leastspecificsupertypeconstruction) + - [preConstructionConfiguration](#preconstructionconfiguration) + - [postConstructionCondition](#postconstructioncondition) + - [advise](#advise) + - [前置](#%E5%89%8D%E7%BD%AE) + - [运行](#%E8%BF%90%E8%A1%8C-3) + - [LoadTimeWeaverAware](#loadtimeweaveraware) + - [BeanClassLoaderAware](#beanclassloaderaware) + - [入口](#%E5%85%A5%E5%8F%A3-3) + - [setBeanClassLoader](#setbeanclassloader) + - [服务器agent](#%E6%9C%8D%E5%8A%A1%E5%99%A8agent) + - [Spring agent](#spring-agent) + - [反射](#%E5%8F%8D%E5%B0%84) + - [总结](#%E6%80%BB%E7%BB%93) + - [ClassFileTransformer](#classfiletransformer) + - [Aj](#aj) + - [缓存](#%E7%BC%93%E5%AD%98) + - [WeavingAdaptor初始化](#weavingadaptor%E5%88%9D%E5%A7%8B%E5%8C%96) + - [aop.xml](#aopxml) + - [解析](#%E8%A7%A3%E6%9E%90-3) + - [注册](#%E6%B3%A8%E5%86%8C) + - [总结](#%E6%80%BB%E7%BB%93-1) + + + # 开头 入口方法在BeanDefinitionParserDelegate.parseCustomElement: diff --git a/note/spring-mvc.md b/note/spring-mvc.md index 4361e72..b217063 100644 --- a/note/spring-mvc.md +++ b/note/spring-mvc.md @@ -1,3 +1,73 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [初始化](#%E5%88%9D%E5%A7%8B%E5%8C%96) + - [容器初始化](#%E5%AE%B9%E5%99%A8%E5%88%9D%E5%A7%8B%E5%8C%96) + - [根容器查找](#%E6%A0%B9%E5%AE%B9%E5%99%A8%E6%9F%A5%E6%89%BE) + - [容器创建](#%E5%AE%B9%E5%99%A8%E5%88%9B%E5%BB%BA) + - [ApplicationContextInitializer](#applicationcontextinitializer) + - [配置解析](#%E9%85%8D%E7%BD%AE%E8%A7%A3%E6%9E%90) + - [注解驱动](#%E6%B3%A8%E8%A7%A3%E9%A9%B1%E5%8A%A8) + - [静态资源处理](#%E9%9D%99%E6%80%81%E8%B5%84%E6%BA%90%E5%A4%84%E7%90%86) + - [拦截器](#%E6%8B%A6%E6%88%AA%E5%99%A8) + - [视图](#%E8%A7%86%E5%9B%BE) + - [Scope/处理器注册](#scope%E5%A4%84%E7%90%86%E5%99%A8%E6%B3%A8%E5%86%8C) + - [MVC初始化](#mvc%E5%88%9D%E5%A7%8B%E5%8C%96) + - [文件上传支持](#%E6%96%87%E4%BB%B6%E4%B8%8A%E4%BC%A0%E6%94%AF%E6%8C%81) + - [地区解析器](#%E5%9C%B0%E5%8C%BA%E8%A7%A3%E6%9E%90%E5%99%A8) + - [主题解析器](#%E4%B8%BB%E9%A2%98%E8%A7%A3%E6%9E%90%E5%99%A8) + - [HandlerMapping检查](#handlermapping%E6%A3%80%E6%9F%A5) + - [HandlerAdapter检查](#handleradapter%E6%A3%80%E6%9F%A5) + - [HandlerExceptionResolver检查](#handlerexceptionresolver%E6%A3%80%E6%9F%A5) + - [RequestToViewNameTranslator](#requesttoviewnametranslator) + - [ViewResolver检查](#viewresolver%E6%A3%80%E6%9F%A5) + - [FlashMapManager](#flashmapmanager) + - [HandlerMapping初始化](#handlermapping%E5%88%9D%E5%A7%8B%E5%8C%96) + - [RequestMappingHandlerMapping](#requestmappinghandlermapping) + - [跨域请求](#%E8%B7%A8%E5%9F%9F%E8%AF%B7%E6%B1%82) + - [拦截器初始化](#%E6%8B%A6%E6%88%AA%E5%99%A8%E5%88%9D%E5%A7%8B%E5%8C%96) + - [HandlerAdapter初始化](#handleradapter%E5%88%9D%E5%A7%8B%E5%8C%96) + - [@ControllerAdvice](#controlleradvice) + - [参数解析器](#%E5%8F%82%E6%95%B0%E8%A7%A3%E6%9E%90%E5%99%A8) + - [@InitBinder支持](#initbinder%E6%94%AF%E6%8C%81) + - [返回结果解析器](#%E8%BF%94%E5%9B%9E%E7%BB%93%E6%9E%9C%E8%A7%A3%E6%9E%90%E5%99%A8) +- [请求响应](#%E8%AF%B7%E6%B1%82%E5%93%8D%E5%BA%94) + - [请求上下文](#%E8%AF%B7%E6%B1%82%E4%B8%8A%E4%B8%8B%E6%96%87) + - [请求分发](#%E8%AF%B7%E6%B1%82%E5%88%86%E5%8F%91) + - [处理器查找](#%E5%A4%84%E7%90%86%E5%99%A8%E6%9F%A5%E6%89%BE) + - [适配器查找](#%E9%80%82%E9%85%8D%E5%99%A8%E6%9F%A5%E6%89%BE) + - [请求处理](#%E8%AF%B7%E6%B1%82%E5%A4%84%E7%90%86) + - [Session同步](#session%E5%90%8C%E6%AD%A5) + - [参数解析](#%E5%8F%82%E6%95%B0%E8%A7%A3%E6%9E%90) + - [策略模式](#%E7%AD%96%E7%95%A5%E6%A8%A1%E5%BC%8F) + - [自定义参数](#%E8%87%AA%E5%AE%9A%E4%B9%89%E5%8F%82%E6%95%B0) + - [参数名是从哪里来的](#%E5%8F%82%E6%95%B0%E5%90%8D%E6%98%AF%E4%BB%8E%E5%93%AA%E9%87%8C%E6%9D%A5%E7%9A%84) + - [Model](#model) + - [总结](#%E6%80%BB%E7%BB%93) + - [返回值解析](#%E8%BF%94%E5%9B%9E%E5%80%BC%E8%A7%A3%E6%9E%90) + - [视图渲染](#%E8%A7%86%E5%9B%BE%E6%B8%B2%E6%9F%93) + - [ModelAndView](#modelandview) + - [渲染](#%E6%B8%B2%E6%9F%93) + - [ViewResolver](#viewresolver) + - [View](#view) +- [拾遗](#%E6%8B%BE%E9%81%97) + - [@ResponseBody](#responsebody) + - [HttpMessageConverter](#httpmessageconverter) + - [自定义](#%E8%87%AA%E5%AE%9A%E4%B9%89) + - [默认](#%E9%BB%98%E8%AE%A4) + - [转换](#%E8%BD%AC%E6%8D%A2) + - [参数解析 & 结果转换](#%E5%8F%82%E6%95%B0%E8%A7%A3%E6%9E%90--%E7%BB%93%E6%9E%9C%E8%BD%AC%E6%8D%A2) + - ["纯"对象参数接收](#%E7%BA%AF%E5%AF%B9%E8%B1%A1%E5%8F%82%E6%95%B0%E6%8E%A5%E6%94%B6) + - [参数对象构造](#%E5%8F%82%E6%95%B0%E5%AF%B9%E8%B1%A1%E6%9E%84%E9%80%A0) + - [参数绑定](#%E5%8F%82%E6%95%B0%E7%BB%91%E5%AE%9A) + - [参数校验](#%E5%8F%82%E6%95%B0%E6%A0%A1%E9%AA%8C) + - [JSR校验](#jsr%E6%A0%A1%E9%AA%8C) + - [自定义校验器](#%E8%87%AA%E5%AE%9A%E4%B9%89%E6%A0%A1%E9%AA%8C%E5%99%A8) + - [一个有意思的问题](#%E4%B8%80%E4%B8%AA%E6%9C%89%E6%84%8F%E6%80%9D%E7%9A%84%E9%97%AE%E9%A2%98) + + + # 初始化 spring-mvc的核心便是DispatcherServlet,所以初始化也是围绕其展开的。类图: diff --git a/note/spring-task.md b/note/spring-task.md index 4212b0c..f84e8e1 100644 --- a/note/spring-task.md +++ b/note/spring-task.md @@ -1,3 +1,27 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [开头](#%E5%BC%80%E5%A4%B4) +- [定时器](#%E5%AE%9A%E6%97%B6%E5%99%A8) + - [用法](#%E7%94%A8%E6%B3%95) + - [解析](#%E8%A7%A3%E6%9E%90) + - [注册](#%E6%B3%A8%E5%86%8C) + - [scheduler](#scheduler) + - [scheduled-tasks](#scheduled-tasks) + - [调度执行](#%E8%B0%83%E5%BA%A6%E6%89%A7%E8%A1%8C) + - [scheduler初始化](#scheduler%E5%88%9D%E5%A7%8B%E5%8C%96) + - [任务调度](#%E4%BB%BB%E5%8A%A1%E8%B0%83%E5%BA%A6) + - [Trigger](#trigger) + - [Cron解析](#cron%E8%A7%A3%E6%9E%90) + - [调度](#%E8%B0%83%E5%BA%A6) + - [总结](#%E6%80%BB%E7%BB%93) +- [异步执行](#%E5%BC%82%E6%AD%A5%E6%89%A7%E8%A1%8C) + - [配置](#%E9%85%8D%E7%BD%AE) + - [原理](#%E5%8E%9F%E7%90%86) + + + # 开头 从功能上来说,spring-task这个组件主要包括了两个/两种功能: diff --git a/note/spring-transaction.md b/note/spring-transaction.md index c6d59d8..296635e 100644 --- a/note/spring-transaction.md +++ b/note/spring-transaction.md @@ -1,3 +1,37 @@ + + +**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)* + +- [配置](#%E9%85%8D%E7%BD%AE) +- [解析](#%E8%A7%A3%E6%9E%90) + - [TransactionalEventListener](#transactionaleventlistener) + - [主要组件注册](#%E4%B8%BB%E8%A6%81%E7%BB%84%E4%BB%B6%E6%B3%A8%E5%86%8C) + - [代理类生成](#%E4%BB%A3%E7%90%86%E7%B1%BB%E7%94%9F%E6%88%90) + - [Advisor寻找](#advisor%E5%AF%BB%E6%89%BE) +- [运行](#%E8%BF%90%E8%A1%8C) + - [调用链生成](#%E8%B0%83%E7%94%A8%E9%93%BE%E7%94%9F%E6%88%90) + - [调用链调用](#%E8%B0%83%E7%94%A8%E9%93%BE%E8%B0%83%E7%94%A8) + - [TransactionInterceptor](#transactioninterceptor) + - [事务管理器](#%E4%BA%8B%E5%8A%A1%E7%AE%A1%E7%90%86%E5%99%A8) + - [DataSource](#datasource) + - [事务开启](#%E4%BA%8B%E5%8A%A1%E5%BC%80%E5%90%AF) + - [是否已存在事务](#%E6%98%AF%E5%90%A6%E5%B7%B2%E5%AD%98%E5%9C%A8%E4%BA%8B%E5%8A%A1) + - [事务已存在](#%E4%BA%8B%E5%8A%A1%E5%B7%B2%E5%AD%98%E5%9C%A8) + - [PROPAGATION_NEVER](#propagation_never) + - [PROPAGATION_NOT_SUPPORTED](#propagation_not_supported) + - [事务挂起](#%E4%BA%8B%E5%8A%A1%E6%8C%82%E8%B5%B7) + - [PROPAGATION_REQUIRES_NEW](#propagation_requires_new) + - [PROPAGATION_NESTED](#propagation_nested) + - [debug环境搭建](#debug%E7%8E%AF%E5%A2%83%E6%90%AD%E5%BB%BA) + - [事务对象](#%E4%BA%8B%E5%8A%A1%E5%AF%B9%E8%B1%A1) + - [Savepoint](#savepoint) + - [其它](#%E5%85%B6%E5%AE%83) + - [事务创建](#%E4%BA%8B%E5%8A%A1%E5%88%9B%E5%BB%BA) + - [事务提交 & 回滚](#%E4%BA%8B%E5%8A%A1%E6%8F%90%E4%BA%A4--%E5%9B%9E%E6%BB%9A) +- [总结](#%E6%80%BB%E7%BB%93) + + + # 配置 以最简单的jdbc事务为例: From bb36b4d9d02b9fd5df4468fc6de772e0f6529cec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: 2019年11月13日 03:59:15 +0000 Subject: [PATCH 06/11] Bump jackson-databind from 2.9.8 to 2.9.10.1 Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.9.8 to 2.9.10.1. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3992b4c..08ecb2f 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.8 + 2.9.10.1 From 2614b08cfd35ab537b9f003849ebb7d1b3f43a5c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2020 17:07:09 +0000 Subject: [PATCH 07/11] Bump hibernate-validator from 6.0.2.Final to 6.1.0.Final Bumps [hibernate-validator](https://github.com/hibernate/hibernate-validator) from 6.0.2.Final to 6.1.0.Final. - [Release notes](https://github.com/hibernate/hibernate-validator/releases) - [Changelog](https://github.com/hibernate/hibernate-validator/blob/master/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-validator/compare/6.0.2.Final...6.1.0.Final) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3992b4c..e8235ba 100644 --- a/pom.xml +++ b/pom.xml @@ -108,7 +108,7 @@ org.hibernate.validator hibernate-validator - 6.0.2.Final + 6.1.0.Final From a41e7b00f3205ab420bb8aebaa47c500ae186773 Mon Sep 17 00:00:00 2001 From: Rocky <846106184@qq.com> Date: 2020年2月13日 15:49:14 +0800 Subject: [PATCH 08/11] =?UTF-8?q?=E7=BA=A0=E6=AD=A3postProcessMergedBeanDe?= =?UTF-8?q?finition=E6=96=B9=E6=B3=95=E7=9A=84=E6=89=A7=E8=A1=8C=E6=97=B6?= =?UTF-8?q?=E6=9C=BA=E7=9A=84=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 纠正MergedBeanDefinitionPostProcessor.postProcessMergedBeanDefinition方法的执行时机的描述 ```java protected Object doCreateBean(final String beanName, final RootBeanDefinition mbd, final Object[] args) { // Instantiate the bean. BeanWrapper instanceWrapper = null; if (mbd.isSingleton()) { instanceWrapper = this.factoryBeanInstanceCache.remove(beanName); } if (instanceWrapper == null) { //createBeanInstance方法已经创建了实例 instanceWrapper = createBeanInstance(beanName, mbd, args); } final Object bean = (instanceWrapper != null ? instanceWrapper.getWrappedInstance() : null); Class beanType = (instanceWrapper != null ? instanceWrapper.getWrappedClass() : null); // Allow post-processors to modify the merged bean definition. synchronized (mbd.postProcessingLock) { if (!mbd.postProcessed) { applyMergedBeanDefinitionPostProcessors(mbd, beanType, beanName); mbd.postProcessed = true; } } } ``` 代码中createBeanInstance方法已经创建了实例 --- note/spring-context.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/note/spring-context.md b/note/spring-context.md index fec3dcc..8bc22f5 100644 --- a/note/spring-context.md +++ b/note/spring-context.md @@ -570,7 +570,7 @@ private static final Callback[] CALLBACKS = new Callback[] { ##### 入口 -其中前者首先被调用,时机是当BeanDefinition被合并(和父Bean),但是还没有用来创建Bean实例时。回顾下其调用入口: +其中前者首先被调用,时机是已创建Bean实例但还没有对实例执行初始化操作。回顾下其调用入口: AbstractAutowireCapableBeanFactory.doCreateBean(简略): From 578992b09e22aadb85c63d822bad679213eda4d3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: 2020年6月18日 15:44:33 +0000 Subject: [PATCH 09/11] Bump jackson-databind from 2.9.10.1 to 2.10.0.pr1 Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.9.10.1 to 2.10.0.pr1. - [Release notes](https://github.com/FasterXML/jackson/releases) - [Commits](https://github.com/FasterXML/jackson/commits) Signed-off-by: dependabot[bot] --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 45a8476..adb42cd 100644 --- a/pom.xml +++ b/pom.xml @@ -90,7 +90,7 @@ com.fasterxml.jackson.core jackson-databind - 2.9.10.1 + 2.10.0.pr1 From 214462c4c583633ca4abf01b7b868dc085425d20 Mon Sep 17 00:00:00 2001 From: YuHui Date: 2021年2月23日 17:02:32 +0800 Subject: [PATCH 10/11] Update spring-boot.md --- note/spring-boot.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/note/spring-boot.md b/note/spring-boot.md index 0993d3b..a05c5ba 100644 --- a/note/spring-boot.md +++ b/note/spring-boot.md @@ -71,7 +71,7 @@ deduceWebEnvironment方法用于检测当前是否是web工程环境,检测的 这货是典型的观察者模式实现,类图: -![ApplicationListener](images/ApplicationListener.PNG) +![ApplicationListener](images/ApplicationListener.png) 在简单的web应用场景下,系统共初始化了这些监听器: From d1ae25dd4dc96efa25d4c0edc7708d32b8776457 Mon Sep 17 00:00:00 2001 From: Carpe-Wang Date: 2023年3月23日 16:03:41 +0800 Subject: [PATCH 11/11] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=B0=91=E6=95=B0md?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- note/Spring.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/note/Spring.md b/note/Spring.md index 0d04abd..0bc359e 100644 --- a/note/Spring.md +++ b/note/Spring.md @@ -220,11 +220,11 @@ protected ConfigurableEnvironment createEnvironment() { ![Environment继承体系](images/Environment.jpg) -Environmen接口**代表了当前应用所处的环境。**从此接口的方法可以看出,其主要和profile、Property相关。 +Environmen接口**代表了当前应用所处的环境。** 从此接口的方法可以看出,其主要和profile、Property相关。 ##### Profile -Spring Profile特性是从3.1开始的,其主要是为了解决这样一种问题: 线上环境和测试环境使用不同的配置或是数据库或是其它。有了Profile便可以在 不同环境之间无缝切换。**Spring容器管理的所有bean都是和一个profile绑定在一起的。**使用了Profile的配置文件示例: +Spring Profile特性是从3.1开始的,其主要是为了解决这样一种问题: 线上环境和测试环境使用不同的配置或是数据库或是其它。有了Profile便可以在 不同环境之间无缝切换。**Spring容器管理的所有bean都是和一个profile绑定在一起的。** 使用了Profile的配置文件示例: ```xml

AltStyle によって変換されたページ (->オリジナル) /