springboot 场景启动器使用解析

这篇文章主要介绍了springboot 场景启动器使用解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

这篇文章主要介绍了springboot 场景启动器使用解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

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

我们直接看pom.xml

   4.0.0com.gongmyspringboot1.0-SNAPSHOT org.springframework.bootspring-boot-starter-parent1.5.9.RELEASE  org.springframework.bootspring-boot-starter-web   org.springframework.bootspring-boot-maven-plugin

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

新文件的开头部分:

  org.springframework.bootspring-boot-dependencies1.5.9.RELEASE../../spring-boot-dependencies

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

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

   4.0.0 org.springframework.bootspring-boot-starters1.5.9.RELEASEspring-boot-starter-webSpring Boot Web StarterStarter for building web, including RESTful, applications using Spring MVC. Uses Tomcat as the default embedded containerhttp://projects.spring.io/spring-boot/ Pivotal Software, Inc.http://www.spring.io ${basedir}/../..  org.springframework.bootspring-boot-starter org.springframework.bootspring-boot-starter-tomcat org.hibernatehibernate-validator com.fasterxml.jackson.corejackson-databind org.springframeworkspring-web org.springframeworkspring-webmvc

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

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

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持html中文网。

以上就是springboot 场景启动器使用解析的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » Java