您好,欢迎来到星星旅游。
搜索
您的当前位置:首页Spring Boot 2.0深度实践之核心技术篇【第一节 系列总览-核心特性】

Spring Boot 2.0深度实践之核心技术篇【第一节 系列总览-核心特性】

来源:星星旅游

1课程导学

1.1 Spring Boot是如何基于Spring Framework逐步走向自动装备?
1.2SpringApplication是怎样掌控Spring应用生命周期?
1.3SpringBoot外部化配置与Spring Environment抽象之间是什么关系?
1.4 Spring Web MVC向Spring Reactive WebFlux过渡的真实价值和意义?

Spring Boot2.0好学么?

  • 组件自动装备:
  • 外部化配置:
  • 嵌入式容器:(Netty:webflux)
  • Spring Boot Starter

Spring Boot难精

  • 组件自动装配: 模式注解、@Enable模块、条件装配、加载机制
  • 外部化配置: Environment抽象、生命周期、破坏性变更
  • 嵌入式容器:Servlet Web容器、Reative Web容器
  • Spring Boot Starter:依赖管理、装配条件、装配顺序
  • -Production-Ready:健康检查、数据指标、@Endpoint管控

Spring Boot与Java EE规范

4 核心特性介绍

5 核心特性之组件自动装配工程部分

6 Web应用介绍


@SpringBootApplication
@ServletComponentScan
public class Application1_7 {

    public static void main(String[] args) {

        SpringApplication.run(Application1_7.class,args);

    }
}
@WebServlet(urlPatterns = "/hi")
public class MyServlet  extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().println("Hey Man");
    }
}

@WebServlet(urlPatterns = "/hi", asyncSupported = true)
public class MyServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.getWriter().println("666666666");
    }
}


@WebServlet(urlPatterns = "/hi", asyncSupported = true)
public class MyServlet  extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        AsyncContext asyncContext = req.startAsync();

        asyncContext.start(() ->{
            try {
                resp.getWriter().println("666666666");
                //触发完成
                asyncContext.complete();
            } catch (IOException e) {
                e.printStackTrace();
            }
        });
    }
}

9 Spring Web MVC 应用介绍




10 Spring WebFlux 应用

  • spring 5开始支持的新特性(是对Servlet的补充,从传统的同步阻塞变成异步非阻塞编程)

  • Reactive:提高系统吞吐量(但是不代表快)


11 Web Server 应用


  • Tomcat的加载优先级高于Jetty,所以需要排除Tomcat.
  • WebFlux的优先级会低于传统的Web容器.

12 数据相关介绍



13 功能扩展介绍



14 运维管理介绍


jsonsole
  • 开放所有webpoints
management.endpoints.web.exposure.include=*

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- stra.cn 版权所有 赣ICP备2024042791号-4

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务