过滤器 Filter

重写 doFilter,init方法

让这个过滤器生效的方法:@Component

异步请求

callable

  1. @RequestMapping("/order")
  2. public Callable<String> order() throws Exception {
  3. logger.info("主线程开始");
  4. Callable<String> result = new Callable<String>() {
  5. @Override
  6. public String call() throws Exception {
  7. logger.info("副线程开始");
  8. Thread.sleep(1000);
  9. logger.info("副线程返回");
  10. return "success";
  11. }
  12. };
  13. logger.info("主线程返回");
  14. }