springboot 场景启动器使用解析

网友投稿 214 2022-12-15


springboot 场景启动器使用解析

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

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

我们直接看pom.xml

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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

xmlns:xsi="http://w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

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


版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:java中不定长参数的实例用法
下一篇:java图片和文本同时提交到表单的实例代码
相关文章

 发表评论

暂时没有评论,来抢沙发吧~