Skip to content

Instantly share code, notes, and snippets.

View qqyycom's full-sized avatar
🌪️
github repositories done

qqyycom qqyycom

🌪️
github repositories done
View GitHub Profile
@qqyycom
qqyycom / gist:bf3fa481fed27ec962193d108aaac916
Created October 8, 2021 01:24
Alexa Discovery Response
{
"event": {
"header": {
"namespace": "Alexa.Discovery",
"name": "Discover.Response",
"messageId": "c2e421b5-a277-4f2f-a4e4-dfaa91eb5391",
"payloadVersion": "3"
},
"payload": {
"endpoints": [
@qqyycom
qqyycom / HashMap.java
Last active April 14, 2020 09:25
resize方法 jdk8
// 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;
@qqyycom
qqyycom / settings.xml
Created December 16, 2019 16:58 — forked from billryan/settings.xml
Maven mirror for Aliyun
<?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
@qqyycom
qqyycom / pom-without-springboot-parent
Created August 25, 2019 17:22
需要依赖自己的parent, 同时需要依赖spring boot
<?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>
@qqyycom
qqyycom / AbstractApplicationContext
Created August 27, 2018 14:53
springBean的生命周期
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();
@qqyycom
qqyycom / AbstractAnnotationConfigDispatcherServletInitializer
Last active December 22, 2020 10:26
springMVC中servletContext的初始化过程
// Initializer结构中最顶层的抽象类,可以直接拓展它,使用了模板方法的设计模式,每个子类都专注一个功能
public abstract class AbstractAnnotationConfigDispatcherServletInitializer
extends AbstractDispatcherServletInitializer {
// 如果实现类没重写createRootApplicationContext()方法, 则在创建RootApplicationContext会被调用
@Override
@Nullable
protected WebApplicationContext createRootApplicationContext() {
//指定rootWebApplicationContext的configClasses类,可以有多个,也可以没有; 如果有,getRootConfigClasses()需要被重写
Class<?>[] configClasses = getRootConfigClasses();