自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 spring中的设计模式 -- 模板模式

模板模式定义和类图AbstractApplicationContext有两个实现子类1:AnnotationConfigApplicationContext 注解的方式把类定义注入ioc容器2:ClassPathXmlApplicationContext xml的方式把类定义注入ioc容器

2022-01-06 10:09:34 344

原创 spring中的设计模式 -- 适配器模式

适配器模式定义适配器模式类图LogFactory.getLog(getClass()) 使用的是适配器模式,以AbstractApplicationContext为例public abstract class AbstractApplicationContext extends DefaultResourceLoader implements ConfigurableApplicationContext { protected final Log logger = LogFactory.

2022-01-06 09:33:11 1384

原创 spring中的设计模式 -- 单例模式

public class AnnotatedBeanDefinitionReader { private BeanNameGenerator beanNameGenerator = AnnotationBeanNameGenerator.INSTANCE;}

2022-01-06 09:11:38 308

原创 jdk与cglib代理源码分析

代理模式类图jdk代理测试代码public interface Calculator { int add(int i, int j); int sub(int i, int j); int mult(int i, int j); int div(int i, int j);} public static void main(String[] args) { //保存生成的代理类的字节码文件 System.getProperties().put

2022-01-04 17:20:57 201

原创 mybatis

jdbc处理数据库步骤1:获取连接Connection2:处理sql PreparedStatement3:处理结果集 ResultSet

2021-11-11 18:01:54 171

原创 spring 注解作用与解析过程

@PostConstruct作用:初始化方法之前执行,作用于方法, 无方法上修饰符限制。解析过程:CommonAnnotationBeanPostProcessor(BeanFactoryAware子类)解析,核心方法, InitDestroyAnnotationBeanPostProcessor下buildLifecycleMetadata方法中method.isAnnotationPresent(this.initAnnotationType) @PostConstructmetho.

2021-08-05 17:26:36 159

原创 消息中间件 MQ

消息中间件应用场景: 异步/解耦/销锋JMS :Java MessageServiceBroker: 消息服务器Provider: 生产者Consumer: 消费者p2p(Quene): 基于点对点的消息模型, Provider发送消息到quene中, Consumer取消息。 可以有多个Consumer,但消息只能被取走一次。 没有Consumer,消息会被保留在quene中, 直到被取走。也就是说, quene中的消息只能被取走一次,没有被取走就被保留。pub/sub(Topic):基于订

2021-08-05 15:06:15 164

原创 spring mvc 流程

spring mvc 流程

2021-07-29 10:06:46 74

原创 Aop 过程

Advice类图AspectJPointcutAdvisor 包装Advicepublic class AspectJPointcutAdvisor implements PointcutAdvisor, Ordered { private final AbstractAspectJAdvice advice; private final Pointcut pointcut; @Nullable private Integer order; }#mermaid-svg-q8QYW8

2021-07-15 13:21:35 242

原创 xml 标签解析过程

1/ 最终调用 DefaultBeanDefinitionDocumentReader#parseBeanDefinitions方法进行解析parseDefaultElement(ele, delegate) 解析默认标签:import/bean/beans/aliasdelegate.parseCustomElement(ele)解析自定义标签:aop:config AopNamespaceHandler类解析...

2021-07-15 09:06:36 363

原创 spring 循环依赖

示例代码public class A { private B b; public B getB() { return b; } public void setB(B b) { this.b = b; }}public class B { private A a; public A getA() { return a; } public void setA(A a) { this.a = a; }}<?xml version="1.0" en

2021-07-08 15:09:07 68

原创 Aware 标识接口

Aware 接口主要用于标识接口。就像下面这样,可以拥有ApplicationContextpublic class ApplicationContextAwareTest implements ApplicationContextAware { private ApplicationContext applicationContext; @Override public void setApplicationContext(ApplicationContext applicationCon

2021-07-07 16:24:14 108 1

原创 populateBean 流程 和 常见的BeanPostProcessor BeanFactoryPostProcessor

#mermaid-svg-EoScznZ5jLzVDQKE .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-EoScznZ5jLzVDQKE .label text{fill:#333}#mermaid-svg-EoScznZ5jLzVDQKE .node rect,#mermaid-svg-EoScznZ5jL

2021-07-07 13:53:17 143

原创 FactoryBean 处理流程

FactoryBean接口中三个方法:T getObject() throws Exception; 指定返回的实例Class<?> getObjectType(); 指定返回的实例类型default boolean isSingleton() {return true; } 指定创建类型,默认单例public class FactoryBeanBean { private String name; public String getName() { return name;

2021-07-03 09:25:42 138

原创 finishBeanFactoryInitialization流程

#mermaid-svg-779h23dbwF9vc1nf .label{font-family:'trebuchet ms', verdana, arial;font-family:var(--mermaid-font-family);fill:#333;color:#333}#mermaid-svg-779h23dbwF9vc1nf .label text{fill:#333}#mermaid-svg-779h23dbwF9vc1nf .node rect,#mermaid-svg-779h23dbwF

2021-07-03 08:34:20 127

原创 ConfigurationClassPostProcessor 解析过程

context:component-scan 解析为bd过程 @Override @Nullable public BeanDefinition parse(Element element, ParserContext parserContext) { String basePackage = element.getAttribute(BASE_PACKAGE_ATTRIBUTE); basePackage = parserContext.getReaderContext().getEnvir

2021-06-30 11:17:34 195

原创 Spring Bean 实例化方式

1. InstanceSupplier方式源码 //createBeanInstance 方法下 Supplier<?> instanceSupplier = mbd.getInstanceSupplier(); if (instanceSupplier != null) { return obtainFromSupplier(instanceSupplier, beanName); }protected BeanWrapper obtainF

2021-06-28 17:33:07 158

原创 lookup-method和replace-method注入

Spring的方法注入可分为两种查找方法注入:用于注入方法返回结果,也就是说能通过配置方式替换方法返回结果。即我们通常所说的lookup-method注入。替换方法注入:可以实现方法主体或返回结果的替换,即我们通常所说的replaced-method注入。1.lookup-method注入解决单例bean引用原型bean的问题。<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframe

2021-06-28 16:06:45 362

原创 Spring Bean实例化过程

Created with Raphaël 2.2.0finishBeanFactoryInitialization(beanFactory)对所有非懒加载的单例对象实例化入口setConversionService类型转换服务addEmbeddedValueResolver设置内置值处理器freezeConfiguration冻结BeanDefinitionpreInstantiateSingletons开始对象的实例化List<String> beanNames = new ArrayList

2021-06-27 09:59:55 78

原创 Spring ApplicationEvent事件机制

ddddddddddd

2021-06-26 17:16:36 275

原创 spring bean 生命周期

Bean 生命周期

2021-06-20 19:43:54 67

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除