SpringBoot框架搭建web服务

时间:2026-02-14 04:51:40

1、使用intellij新建一个maven工程,注意不用勾选archetype,点击下一步

SpringBoot框架搭建web服务

2、按照提示填写groupId和artifactId以及项目名称等信息,点击Finish

SpringBoot框架搭建web服务

SpringBoot框架搭建web服务

3、打开pom.xml,添加以下内容:

<parent>    <groupId>org.springframework.boot</groupId>    <artifactId>spring-boot-starter-parent</artifactId>    <version>2.0.0.RELEASE</version</parent<build>    <plugins>        <plugin>            <groupId>org.springframework.boot</groupId>            <artifactId>spring-boot-maven-plugin</artifactId        </plugin>    </plugins></build><dependencies>    <dependency>        <groupId>org.springframework.boot</groupId>        <artifactId>spring-boot-starter-web</artifactId>    </dependency</dependencies>

SpringBoot框架搭建web服务

4、编写启动类,并运行main方法

SpringBoot框架搭建web服务

5、SpringBoot搭建web服务到这里就完成了,打开浏览器,输入http://localhost:8080/

SpringBoot框架搭建web服务

© 2026 五度知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com