zoukankan      html  css  js  c++  java
  • SpringBoot架构浅谈

    首先来说一下什么是spring boot架构

    Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程。该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。用我的话来理解,就是spring boot其实不是什么新的框架,它默认配置了很多框架的使用方式,就像maven整合了所有的jar包,spring boot整合Web项目所需要的框架。

    那么spring boot有能够解决什么问题呢?

    1) Spring Boot使编码变简单

         2) Spring Boot使配置变简单

         3) Spring Boot使部署变简单

         4) Spring Boot使监控变简单

         5) Spring Boot的不足

    下面说一下Spring Boo的在平台中的定位,以及如何与相关的技术想融合

         1) SpringBoot与SEDA +MicroService + RESTful

         2) SpringBoot与Mock

    然后再来看一看采用了这个 SpringBoot之后,技术的管理应该如何做

    SpringBoot是伴随着Spring4.0诞生的;

    从字面理解,Boot是引导的意思,因此SpringBoot帮助开发者快速搭建Spring框架;

    SpringBoot帮助开发者快速启动一个Web容器;

    SpringBoot继承了原有Spring框架的优秀基因;

    SpringBoot简化了使用Spring的过程

    那么应该如何使用SpringBoot到实践当中呢?

    首先来说一说starter *的pom依赖

    使用SpringBoot开发时,在pom.xml文件中引入的依赖一般都是形如spring-boot-starter-*。starter依赖是居于某个场景或者功能的,我们引入一个starter依赖之后,它会间接引入实现这个场景或功能所需的其他依赖。我们可以把这些starters称为场景启动器,只需要在项目里面引入这些starter相关场景的所有依赖都会导入进来。要用什么功能就导入什么场景的启动器。这里以spring-boot-starter-web为例分析。

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId></dependency>

    spring-boot-starter-web的间接依赖


    我们来看下spring-boot-starter-web的pom文件,它定义了一个父类spring-boot-starters

    复制代码
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starters</artifactId>
            <version>1.5.4.RELEASE</version>
        </parent>
        <artifactId>spring-boot-starter-web</artifactId>
        <name>Spring Boot Web Starter</name>
        <url>http://projects.spring.io/spring-boot/</url>
        <organization>
            <name>Pivotal Software, Inc.</name>
            <url>http://www.spring.io</url>
        </organization>
        <properties>
            <main.basedir>${basedir}/../..</main.basedir>
        </properties>
    复制代码

    spring-boot-starters的打包类型为pom,它定义好了SpringBoot中所有的starter,同时它的父类为spring-boot-parent

    复制代码
        <parent>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-parent</artifactId>
            <version>1.5.4.RELEASE</version>
            <relativePath>../spring-boot-parent</relativePath>
        </parent>
        <artifactId>spring-boot-starters</artifactId>
        <packaging>pom</packaging>
        <name>Spring Boot Starters</name>
        <description>Spring Boot Starters</description>
        <url>http://projects.spring.io/spring-boot/</url>
        <organization>
            <name>Pivotal Software, Inc.</name>
            <url>http://www.spring.io</url>
        </organization>
        <properties>
            <main.basedir>${basedir}/..</main.basedir>
        </properties>
        <modules>
            <module>spring-boot-starter</module>
            <module>spring-boot-starter-activemq</module>
            <module>spring-boot-starter-amqp</module>
            <module>spring-boot-starter-aop</module>
            <module>spring-boot-starter-artemis</module>
            <module>spring-boot-starter-batch</module>
            <module>spring-boot-starter-cache</module>
            <module>spring-boot-starter-cloud-connectors</module>
            <module>spring-boot-starter-data-cassandra</module>
            <module>spring-boot-starter-data-couchbase</module>
            <module>spring-boot-starter-data-elasticsearch</module>
            <module>spring-boot-starter-data-gemfire</module>
            <module>spring-boot-starter-data-jpa</module>
            <module>spring-boot-starter-data-ldap</module>
            <module>spring-boot-starter-data-mongodb</module>
            <module>spring-boot-starter-data-neo4j</module>
            <module>spring-boot-starter-data-redis</module>
            <module>spring-boot-starter-data-rest</module>
            <module>spring-boot-starter-data-solr</module>
            <module>spring-boot-starter-freemarker</module>
            <module>spring-boot-starter-groovy-templates</module>
            <module>spring-boot-starter-hateoas</module>
            <module>spring-boot-starter-integration</module>
            <module>spring-boot-starter-jdbc</module>
            <module>spring-boot-starter-jersey</module>
            <module>spring-boot-starter-jetty</module>
            <module>spring-boot-starter-jooq</module>
            <module>spring-boot-starter-jta-atomikos</module>
            <module>spring-boot-starter-jta-bitronix</module>
            <module>spring-boot-starter-jta-narayana</module>
            <module>spring-boot-starter-logging</module>
            <module>spring-boot-starter-log4j2</module>
            <module>spring-boot-starter-mail</module>
            <module>spring-boot-starter-mobile</module>
            <module>spring-boot-starter-mustache</module>
            <module>spring-boot-starter-actuator</module>
            <module>spring-boot-starter-parent</module>
            <module>spring-boot-starter-security</module>
            <module>spring-boot-starter-social-facebook</module>
            <module>spring-boot-starter-social-twitter</module>
            <module>spring-boot-starter-social-linkedin</module>
            <module>spring-boot-starter-remote-shell</module>
            <module>spring-boot-starter-test</module>
            <module>spring-boot-starter-thymeleaf</module>
            <module>spring-boot-starter-tomcat</module>
            <module>spring-boot-starter-undertow</module>
            <module>spring-boot-starter-validation</module>
            <module>spring-boot-starter-web</module>
            <module>spring-boot-starter-websocket</module>
            <module>spring-boot-starter-web-services</module>
        </modules>
     
    复制代码

    引用:www.imooc.com/article/274147?block_id=tuijian_wz

    https://www.cnblogs.com/anywherego/p/9591252.html

  • 相关阅读:
    读入输出优化模板
    HDU-2647 Reward(拓扑排序)
    HDU-2647 Reward(拓扑排序)
    HDU-2647 Reward(拓扑排序)
    HDU-2647 Reward(拓扑排序)
    Using KafkaBolt to write to a kafka topic
    Using KafkaBolt to write to a kafka topic
    Using KafkaBolt to write to a kafka topic
    Using KafkaBolt to write to a kafka topic
    getElementById() 获取指定ID的第一个元素
  • 原文地址:https://www.cnblogs.com/zhangliqiangvictory/p/11028459.html
Copyright © 2011-2022 走看看