Restful 是一个概念,Rest是一个架构,与其唯一绑定的实例就是http。
关于restful:https://www.runoob.com/w3cnote/restful-architecture.html
内容来源于spring官网:https://spring.io/guides/gs/rest-service/
使用 Spring/SpringBoot/Maven/Tomcat
1.使用IDEA建立Maven项目
创建完之后在src/main/java下创建包 hello
目录结构为:
└── src
└── main
└── java
└── hello
配置pom.xml
-
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>lsl</groupId> <artifactId>RestfulWebServiceHelloworld</artifactId> <version>1.0-SNAPSHOT</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.6.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>com.jayway.jsonpath</groupId> <artifactId>json-path</artifactI