本文介绍了我可以将Maven Project转换为SpringBoot吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Eclipse中有一个Maven项目,现在我需要添加数据库连接.我的课本在Maven中完成了所有json教程.现在,在有关JDBC的本章中,他们正在使用SpringBoot.

I have a Maven Project in Eclipse and now I need to add database connectivity. My textbook did all json tutorials in Maven. Now in this chapter on JDBC they are using SpringBoot.

我可以将项目转换为SpringBoot吗?或启动一个SpringBoot并导入我以前的Maven类.

Can I convert the project to SpringBoot? Or start a SpringBoot and import my previous Maven classes.

推荐答案

此处介绍如何在SpringBoot项目中使用maven.

Here is described how to use maven for a SpringBoot Project.

您将需要修改现有的pom.xml以添加如下内容以使其成为SpringBoot项目:

You will need to modify your existing pom.xml to add something like this to make it a SpringBoot Project:

<!-- Inherit defaults from Spring Boot -->
<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.2.2.RELEASE</version>
</parent>

<!-- Add typical dependencies for a web application -->
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
</dependencies>

<!-- Package as an executable jar -->
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

这篇关于我可以将Maven Project转换为SpringBoot吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 00:59