栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

springboot 场景启动器使用解析

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

springboot 场景启动器使用解析

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

为什么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,这些场景的相关依赖包就会自动导入出来。

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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/135363.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号