SpringBoot框架搭建web服务

2025-10-30 02:47:03

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服务

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢