spring boot架構淺談


首先來說一下什么是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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM