SpringBoot 自定义线程池

我们都知道spring只是为我们简单的处理线程池,每次用到线程总会new 一个新的线程,效率不高,所以我们需要自定义一个线程池。

本教程目录:

  1. 自定义线程池
  2. 配置spring默认的线程池

1. 自定义线程池

1.1 修改application.properties
task.pool.corePoolSize=20
task.pool.maxPoolSize=40
task.pool.keepAliveSeconds=300
task.pool.queueCapacity=50
1.2 线程池配置属性类TaskThreadPoolConfig .java
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * 线程池配置属性类
 * Created by Fant.J.
 */
@ConfigurationProperties(prefix = "task.pool")
public class TaskThreadPoolConfig {
    private int corePoolSize;

    private int maxPoolSize;

    private int keepAliveSeconds;

    private int queueCapacity;
    ...getter and setter methods...
}
1.3 创建线程池 TaskExecutePool .java
/**
 * 创建线程池
 * Created by Fant.J.
 */
@Configuration
@EnableAsync
public class TaskExecutePool {
    @Autowired
    private TaskThreadPoolConfig config;

    @Bean
    public Executor myTaskAsyncPool() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        //核心线程池大小
        executor.setCorePoolSize(config.getCorePoolSize());
        //最大线程数
        executor.setMaxPoolSize(config.getMaxPoolSize());
        //队列容量
        executor.setQueueCapacity(config.getQueueCapacity());
        //活跃时间
        executor.setKeepAliveSeconds(config.getKeepAliveSeconds());
        //线程名字前缀
        executor.setThreadNamePrefix("MyExecutor-");

        // setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务
        // CallerRunsPolicy:不在新线程中执行任务,而是由调用者所在的线程来执行
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
        executor.initialize();
        return executor;
    }
}

1.4 创建线程任务
/**
 * Created by Fant.J.
 */
@Component
public class AsyncTask {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Async("myTaskAsyncPool")  //myTaskAsynPool即配置线程池的方法名,此处如果不写自定义线程池的方法名,会使用默认的线程池
    public void doTask1(int i) throws InterruptedException{
        logger.info("Task"+i+" started.");
    }
}

1.5 修改启动类

给启动类添加注解

@EnableAsync
@EnableConfigurationProperties({TaskThreadPoolConfig.class} ) // 开启配置属性支持
1.6 测试
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private AsyncTask asyncTask;

    @Test
    public void AsyncTaskTest() throws InterruptedException, ExecutionException {

        for (int i = 0; i < 100; i++) {
            asyncTask.doTask1(i);
        }
        logger.info("All tasks finished.");
    }

2. 配置默认的线程池

我本人喜欢用这种方式的线程池,因为上面的那个线程池使用时候总要加注解@Async("myTaskAsyncPool"),而这种重写spring默认线程池的方式使用的时候,只需要加@Async注解就可以,不用去声明线程池类。

2.1 获取属性配置类

这个和上面的TaskThreadPoolConfig类相同,这里不重复

2.2 NativeAsyncTaskExecutePool.java 装配线程池
/**
 * 原生(Spring)异步任务线程池装配类
 * Created by Fant.J.
 */
@Slf4j
@Configuration
public class NativeAsyncTaskExecutePool implements AsyncConfigurer{


    //注入配置类
    @Autowired
    TaskThreadPoolConfig config;

    @Override
    public Executor getAsyncExecutor() {
        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
        //核心线程池大小
        executor.setCorePoolSize(config.getCorePoolSize());
        //最大线程数
        executor.setMaxPoolSize(config.getMaxPoolSize());
        //队列容量
        executor.setQueueCapacity(config.getQueueCapacity());
        //活跃时间
        executor.setKeepAliveSeconds(config.getKeepAliveSeconds());
        //线程名字前缀
        executor.setThreadNamePrefix("MyExecutor-");

        // setRejectedExecutionHandler:当pool已经达到max size的时候,如何处理新任务
        // CallerRunsPolicy:不在新线程中执行任务,而是由调用者所在的线程来执行
        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
        executor.initialize();
        return executor;
    }


    /**
     *  异步任务中异常处理
     * @return
     */
    @Override
    public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
        return new AsyncUncaughtExceptionHandler() {

            @Override
            public void handleUncaughtException(Throwable arg0, Method arg1, Object... arg2) {
                log.error("=========================="+arg0.getMessage()+"=======================", arg0);
                log.error("exception method:"+arg1.getName());
            }
        };
    }
}

2.3 线程任务类AsyncTask .java
@Component
public class AsyncTask {
    protected final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Async
    public void doTask2(int i) throws InterruptedException{
        logger.info("Task2-Native"+i+" started.");
    }
}
2.4 测试
    @Test
    public void AsyncTaskNativeTest() throws InterruptedException, ExecutionException {

        for (int i = 0; i < 100; i++) {
            asyncTask.doTask2(i);
        }

        logger.info("All tasks finished.");
    }
2018-03-25 21:23:07.655  INFO 4668 --- [   MyExecutor-8] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native6 started.
2018-03-25 21:23:07.655  INFO 4668 --- [   MyExecutor-3] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native1 started.
2018-03-25 21:23:07.655  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native7 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native21 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native22 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native23 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native24 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native25 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native26 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native27 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native28 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native29 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native30 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native31 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native32 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native33 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native34 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native35 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native36 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native37 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native38 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native39 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native40 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native41 started.
2018-03-25 21:23:07.657  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native42 started.
2018-03-25 21:23:07.657  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native43 started.
2018-03-25 21:23:07.657  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native44 started.
2018-03-25 21:23:07.657  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native45 started.
2018-03-25 21:23:07.657  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native46 started.
2018-03-25 21:23:07.658  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native47 started.
2018-03-25 21:23:07.655  INFO 4668 --- [   MyExecutor-7] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native5 started.
2018-03-25 21:23:07.658  INFO 4668 --- [   MyExecutor-7] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native49 started.
2018-03-25 21:23:07.658  INFO 4668 --- [   MyExecutor-7] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native50 started.
2018-03-25 21:23:07.658  INFO 4668 --- [  MyExecutor-11] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native9 started.
2018-03-25 21:23:07.655  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native4 started.
2018-03-25 21:23:07.659  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native53 started.
2018-03-25 21:23:07.659  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native54 started.
2018-03-25 21:23:07.659  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native55 started.
2018-03-25 21:23:07.659  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native56 started.
2018-03-25 21:23:07.659  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native57 started.
2018-03-25 21:23:07.659  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native58 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native59 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native60 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native61 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native62 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native63 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native64 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native65 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native66 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native67 started.
2018-03-25 21:23:07.660  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native68 started.
2018-03-25 21:23:07.655  INFO 4668 --- [   MyExecutor-5] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native3 started.
2018-03-25 21:23:07.655  INFO 4668 --- [   MyExecutor-4] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native2 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-8] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native19 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-2] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native0 started.
2018-03-25 21:23:07.656  INFO 4668 --- [   MyExecutor-3] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native20 started.
2018-03-25 21:23:07.657  INFO 4668 --- [  MyExecutor-10] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native8 started.
2018-03-25 21:23:07.658  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native48 started.
2018-03-25 21:23:07.658  INFO 4668 --- [   MyExecutor-7] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native51 started.
2018-03-25 21:23:07.658  INFO 4668 --- [  MyExecutor-11] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native52 started.
2018-03-25 21:23:07.658  INFO 4668 --- [  MyExecutor-12] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native10 started.
2018-03-25 21:23:07.661  INFO 4668 --- [  MyExecutor-13] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native11 started.
2018-03-25 21:23:07.662  INFO 4668 --- [  MyExecutor-14] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native12 started.
2018-03-25 21:23:07.662  INFO 4668 --- [  MyExecutor-15] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native13 started.
2018-03-25 21:23:07.663  INFO 4668 --- [  MyExecutor-16] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native14 started.
2018-03-25 21:23:07.663  INFO 4668 --- [  MyExecutor-17] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native15 started.
2018-03-25 21:23:07.663  INFO 4668 --- [  MyExecutor-18] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native16 started.
2018-03-25 21:23:07.663  INFO 4668 --- [  MyExecutor-19] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native17 started.
2018-03-25 21:23:07.664  INFO 4668 --- [  MyExecutor-20] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native18 started.
2018-03-25 21:23:07.664  INFO 4668 --- [  MyExecutor-21] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native69 started.
2018-03-25 21:23:07.664  INFO 4668 --- [           main] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native89 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-6] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native90 started.
2018-03-25 21:23:07.664  INFO 4668 --- [  MyExecutor-22] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native70 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-5] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native91 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-5] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native92 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-8] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native93 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-2] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native94 started.
2018-03-25 21:23:07.664  INFO 4668 --- [  MyExecutor-10] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native95 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-3] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native96 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-7] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native98 started.
2018-03-25 21:23:07.664  INFO 4668 --- [   MyExecutor-9] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native97 started.
2018-03-25 21:23:07.664  INFO 4668 --- [  MyExecutor-11] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native99 started.
2018-03-25 21:23:07.664  INFO 4668 --- [           main] com.laojiao.securitydemo.ControllerTest  : All tasks finished.
2018-03-25 21:23:07.666  INFO 4668 --- [  MyExecutor-23] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native71 started.
2018-03-25 21:23:07.667  INFO 4668 --- [  MyExecutor-24] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native72 started.
2018-03-25 21:23:07.667  INFO 4668 --- [  MyExecutor-25] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native73 started.
2018-03-25 21:23:07.669  INFO 4668 --- [  MyExecutor-26] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native74 started.
2018-03-25 21:23:07.669  INFO 4668 --- [  MyExecutor-27] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native75 started.
2018-03-25 21:23:07.673  INFO 4668 --- [  MyExecutor-28] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native76 started.
2018-03-25 21:23:07.674  INFO 4668 --- [  MyExecutor-29] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native77 started.
2018-03-25 21:23:07.674  INFO 4668 --- [  MyExecutor-30] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native78 started.
2018-03-25 21:23:07.676  INFO 4668 --- [  MyExecutor-31] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native79 started.
2018-03-25 21:23:07.677  INFO 4668 --- [  MyExecutor-32] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native80 started.
2018-03-25 21:23:07.677  INFO 4668 --- [  MyExecutor-33] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native81 started.
2018-03-25 21:23:07.677  INFO 4668 --- [  MyExecutor-34] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native82 started.
2018-03-25 21:23:07.678  INFO 4668 --- [  MyExecutor-35] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native83 started.
2018-03-25 21:23:07.679  INFO 4668 --- [  MyExecutor-36] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native84 started.
2018-03-25 21:23:07.679  INFO 4668 --- [  MyExecutor-37] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native85 started.
2018-03-25 21:23:07.679  INFO 4668 --- [  MyExecutor-38] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native86 started.
2018-03-25 21:23:07.680  INFO 4668 --- [  MyExecutor-39] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native87 started.
2018-03-25 21:23:07.680  INFO 4668 --- [  MyExecutor-40] c.l.securitydemo.mythreadpool.AsyncTask  : Task2-Native88 started.

介绍下我的所有文集:

流行框架

SpringCloud
springboot
nginx
redis

底层实现原理:

Java NIO教程
Java reflection 反射详解
Java并发学习笔录
Java Servlet教程
jdbc组件详解
Java NIO教程
Java语言/版本 研究

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,793评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 87,567评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,342评论 0 338
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,825评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,814评论 5 368
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,680评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,033评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,687评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 42,175评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,668评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,775评论 1 332
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,419评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,020评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,978评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,206评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,092评论 2 351
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,510评论 2 343

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,596评论 18 139
  • Spring Boot 参考指南 介绍 转载自:https://www.gitbook.com/book/qbgb...
    毛宇鹏阅读 46,736评论 6 342
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 171,454评论 25 707
  • 晚上洗澡,用了我新入的舒缓滋养乳液,打开口,淡淡的花香,挤出来一些在手上,滑滑的,香香的,特别滋润。 洗完我就去吹...
    王莎莎2017阅读 281评论 0 0
  • 楔子 给我这个列表里面所有员工的平均薪酬。通常可能会这样写 但是KVC提供了一种更加简洁的方法,那就是使用集合运算...
    NapoleonY阅读 2,529评论 2 7