SpringBoot快速入门,不继承SpringBoot父依赖项目

来源:互联网 发布:mysql qps 编辑:程序博客网 时间:2024/05/10 19:44

需求描述:SpringBoot快速入门, 这篇博客记录如何使用SpringBoot快速创建一个HelloWorld程序。其中,在pom文件中,使用的SpringBoot提供的父依赖项目。在真实的企业级项目,我们可能会有自己的父项目,不想依赖Spring提供的父项目。那么如何解决呢?

  1. 第一步:修改pom文件,将原来的parent节点替换成如下依赖即可:
<dependencyManagement>        <dependencies>            <dependency>                <!-- Import dependency management from Spring Boot -->                <groupId>org.springframework.boot</groupId>                <artifactId>spring-boot-dependencies</artifactId>                <version>1.4.3.RELEASE</version>                <type>pom</type>                <scope>import</scope>            </dependency>        </dependencies>    </dependencyManagement>

其余配置和SpringBoot快速入门程序一样,启动类和测试步骤均一样。

参考链接:http://docs.spring.io/spring-boot/docs/1.4.3.RELEASE/reference/htmlsingle/#using-boot-maven-without-a-parent

源代码链接:https://github.com/myNameIssls/springboot-study

0 0