This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initializer结构中最顶层的抽象类,可以直接拓展它,使用了模板方法的设计模式,每个子类都专注一个功能 | |
public abstract class AbstractAnnotationConfigDispatcherServletInitializer | |
extends AbstractDispatcherServletInitializer { | |
// 如果实现类没重写createRootApplicationContext()方法, 则在创建RootApplicationContext会被调用 | |
@Override | |
@Nullable | |
protected WebApplicationContext createRootApplicationContext() { | |
//指定rootWebApplicationContext的configClasses类,可以有多个,也可以没有; 如果有,getRootConfigClasses()需要被重写 | |
Class<?>[] configClasses = getRootConfigClasses(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class AbstractApplicationContext extends DefaultResourceLoader | |
implements ConfigurableApplicationContext { | |
//每次refresh会destory Beanfactory中已经初始化的对象 | |
public void refresh() throws BeansException, IllegalStateException { | |
synchronized (this.startupShutdownMonitor) { | |
prepareRefresh(); | |
// ,刷新beanFactory(如果没有,就创建一个)从配置文件或配置类中读取beanName,beanDefinition等信息,并注册到beanFactory中 | |
ConfigurableListableBeanFactory beanFactory = obtainFreshBeanFactory(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.learning.spring</groupId> | |
<artifactId>hello-spring</artifactId> | |
<version>0.0.1-SNAPSHOT</version> | |
<name>hello-spring</name> | |
<description>hello spring</description> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one | |
or more contributor license agreements. See the NOTICE file | |
distributed with this work for additional information | |
regarding copyright ownership. The ASF licenses this file | |
to you under the Apache License, Version 2.0 (the | |
"License"); you may not use this file except in compliance | |
with the License. You may obtain a copy of the License at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// hashmap的扩容方法 | |
final Node<K,V>[] resize() { | |
Node<K,V>[] oldTab = table; | |
int oldCap = (oldTab == null) ? 0 : oldTab.length; | |
int oldThr = threshold; | |
int newCap, newThr = 0; | |
if (oldCap > 0) { | |
if (oldCap >= MAXIMUM_CAPACITY) { | |
threshold = Integer.MAX_VALUE; | |
return oldTab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"event": { | |
"header": { | |
"namespace": "Alexa.Discovery", | |
"name": "Discover.Response", | |
"messageId": "c2e421b5-a277-4f2f-a4e4-dfaa91eb5391", | |
"payloadVersion": "3" | |
}, | |
"payload": { | |
"endpoints": [ |