这篇文章主要介绍了springboot 场景启动器使用解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
为什么springboot不需要我们去配置那么繁琐的东西?
我们直接看pom.xml
4.0.0 com.gong myspringboot1.0-SNAPSHOT org.springframework.boot spring-boot-starter-parent1.5.9.RELEASE org.springframework.boot spring-boot-starter-weborg.springframework.boot spring-boot-maven-plugin
首先看spring-boot-starter-parent,spring-boot-start就是场景启动器,这是所有项目的父项目,我们ctrl+鼠标左键点进去:
新文件的开头部分:
org.springframework.boot spring-boot-dependencies1.5.9.RELEASE ../../spring-boot-dependencies
它的父项目是spring-boot-dependencies,用于管理依赖包的版本号。也就是说spring-boot-start-parent是版本仲裁中心。
再来看spring-boot-starter-web,我们来查看其中有什么:
4.0.0 spring-boot-starter-web org.springframework.boot spring-boot-starters1.5.9.RELEASE 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-starterorg.springframework.boot spring-boot-starter-tomcatorg.hibernate hibernate-validatorcom.fasterxml.jackson.core jackson-databindorg.springframework spring-weborg.springframework spring-webmvc
这里面才是帮我们导入了真正所需的依赖包。
springboot还有许多场景启动器,例如AOP、邮件开发等等。我们只需要在项目里面引用这些starter,这些场景的相关依赖包就会自动导入出来。
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持考高分网。



