建一个RESTFul web service 服务.
1 IDE: IntelliJ IDEA;
2 项目为Maven项目.
---------目标----------------
What you’ll build
You’ll build a service that will accept HTTP GET requests at:
http://localhost:8080/greeting
and respond with a JSON representation of a greeting:
{"id":1,"content":"Hello, World!"}
You can customize the greeting with an optional name
parameter in the query string:
http://localhost:8080/greeting?name=User
The name
parameter value overrides the default value of "World" and is reflected in the response:
{"id":1,"content":"Hello, User!"}
Download and unzip the source repository for this guide, or clone it using Git: git clone https://github.com/spring-guides/gs-rest-service.git
With IntelliJ IDEA up and running, click Import Project on the Welcome Screen, or File | Open on the main menu:
选择 pom.xml
运行即可!
-------------------验证-----------------
浏览器中输入 上文提到的地址即可!