成都创新互联网站制作重庆分公司

springboot场景启动器怎么用

这篇文章将为大家详细讲解有关springboot场景启动器怎么用,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。

创新互联公司科技有限公司专业互联网基础服务商,为您提供达州托管服务器高防服务器租用,成都IDC机房托管,成都主机托管等互联网服务。

为什么springboot不需要我们去配置那么繁琐的东西?

我们直接看pom.xml

  4.0.0  com.gong  myspringboot  1.0-SNAPSHOT      org.springframework.boot    spring-boot-starter-parent    1.5.9.RELEASE                  org.springframework.boot      spring-boot-starter-web                          org.springframework.boot        spring-boot-maven-plugin            

首先看spring-boot-starter-parent,spring-boot-start就是场景启动器,这是所有项目的父项目,我们ctrl+鼠标左键点进去:

新文件的开头部分:

    org.springframework.boot    spring-boot-dependencies    1.5.9.RELEASE    ../../spring-boot-dependencies  

它的父项目是spring-boot-dependencies,用于管理依赖包的版本号。也就是说spring-boot-start-parent是版本仲裁中心。

再来看spring-boot-starter-web,我们来查看其中有什么:

  4.0.0      org.springframework.boot    spring-boot-starters    1.5.9.RELEASE    spring-boot-starter-web  Spring Boot Web Starter  Starter for building web, including RESTful, applications using Spring    MVC. Uses Tomcat as the default embedded container  http://projects.spring.io/spring-boot/      Pivotal Software, Inc.    http://www.spring.io        ${basedir}/../..              org.springframework.boot      spring-boot-starter              org.springframework.boot      spring-boot-starter-tomcat              org.hibernate      hibernate-validator              com.fasterxml.jackson.core      jackson-databind              org.springframework      spring-web              org.springframework      spring-webmvc      

这里面才是帮我们导入了真正所需的依赖包。

springboot还有许多场景启动器,例如AOP、邮件开发等等。我们只需要在项目里面引用这些starter,这些场景的相关依赖包就会自动导入出来。

关于“springboot场景启动器怎么用”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。


当前标题:springboot场景启动器怎么用
分享网址:http://cxhlcq.com/article/jdhgdo.html

其他资讯

在线咨询

微信咨询

电话咨询

028-86922220(工作日)

18980820575(7×24)

提交需求

返回顶部