npm和yarn国内镜像

npm

淘宝:

npm config set registry https://registry.npm.taobao.org

腾讯:

npm config set registry http://mirrors.cloud.tencent.com/npm/

恢复:

npm config set registry https://registry.npmjs.org

检查:

npm config list

SpringBoot2源码解析 ApplicationListener

系统监听器

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
import org.springframework.boot.context.event.ApplicationStartedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.lang.NonNull;

/**
 * @author itning
 * @date 2020/4/29 16:59
 */
public class FirstListener implements ApplicationListener<ApplicationStartedEvent> {
    @Override
    public void onApplicationEvent(@NonNull ApplicationStartedEvent event) {
        System.out.println("FirstListener");
    }
}

SpringBoot2源码解析 ApplicationContextInitializer

系统初始化器

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
import org.springframework.context.ApplicationContextInitializer;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.annotation.Order;
import org.springframework.lang.NonNull;

/**
 * @author itning
 * @date 2020/4/28 20:43
 */
@Order(1)
public class FirstApplicationContextInitializer implements ApplicationContextInitializer<ConfigurableApplicationContext> {
    @Override
    public void initialize(@NonNull ConfigurableApplicationContext applicationContext) {
        System.out.println("FirstApplicationContextInitializer");
    }
}

Spring Annotations

0.前言

转载自:https://github.com/Snailclimb/JavaGuide

可以毫不夸张地说,这篇文章介绍的 Spring/SpringBoot 常用注解基本已经涵盖你工作中遇到的大部分常用的场景。对于每一个注解我都说了具体用法,掌握搞懂,使用 SpringBoot 来开发项目基本没啥大问题了!