《Spring Boot 编程思想》 Spring Boot概览

理解独立的Spring应用

Spring的Web服务包括两种:
ServletWeb服务和Reactive Web(通过Reactive Web容器实现,Spring5.0 WebFlux)
使用ServletWeb和Reactive Web不一样的地方:
1、设置setApplicationType(WebApplicationTyp)类型不同
2、starter不同

Spring boot利用spring-boot-maven-plugin可运行的fat jar,可以使用java -jar target/user-server-0.0.1-SNAPSHOT.jar(线上环境)或者mvn spring-boot:run(开发环境)找执行

打包的结果如下图:
在这里插入图片描述
上面一个jar打入了依赖包,下面一个只有本地资源。

理解固话的Maven依赖

1、spring-boot-dependencies是spring-boot-starter-parent的parent
2、不依赖spring-boot-starter-parent时在dependencyManagemenge中依赖spring-boot-dependencies想要使用spring-boot-maven-plugin打包需要单独配置他的版本号,repackage元素。
3、spring-boot-starter-web依赖引入了spring-boot-starter-tomcat 使用了Tomcat 容器

例如依赖spring-boot-starter-parent:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.2.5.RELEASE</version>
</parent>

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值