Java 多线程中 Thread、Runnable 和 FutureTask 比较

1. 用 Thread 创建一个线程

public class ThreadTest {
  public static class MyThread extends Thread {
    @Override
    public void run() {
      Thread.sleep(100);
      System.out.println("Hello world");
    }
  }

  public static void main(String[] args) {
    // 创建线程
    MyThread myThread = new MyThread();
    // 启动线程
阅读更多

Spring boot 打 war 包

2019_06_27

第一步

在启动类的同级目录下新建一个 ServletInitializer.java

public class ServletInitializer extends SpringBootServletInitializer {
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    // DemoApplication.class 是启动类
    return application.sources(DemoApplication.class);
  }
}

第二步

修改 maven 的打包

阅读更多