Spring Boot基础教程2-RESTfull API简单项目的快速搭建

mac2025-05-16  17

搭建一个简单的RESTfull API接口项目

 

spring-boot-starter-web的引入,其依赖包的学习

spring-boot-devtools的引入,其依赖包的学习

代码的实现

 

 

运行项目

直接运行main方法或者使用maven命令: spring-boot:run

测试: http://localhost:8080/index

带参数:http://localhost:8080/index/get?name=wujing

带参数有中文:http://localhost:8080/index/get?name=无境

url测试:http://localhost:8080/index/get/1/wujing

url测试:http://localhost:8080/index/get/1/无境

 

5.打包

命令: clean package

 

运行命令: java –jar roncoo-education-0.0.1-SNAPSHOT.jar

 

最新回复(0)