扫码一下
查看教程更方便
现在在 idea 中,启动服务。
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: spring boot :: (v2.6.6)
2022-05-04 09:40:27.442 info 8704 --- [ restartedmain] c.t.s.springbootormapplication : starting springbootormapplication using java 11.0.11 on
...
2022-05-04 09:40:34.775 info 8704 --- [ restartedmain] o.s.b.d.a.optionallivereloadserver : livereload server is running on port 35729
2022-05-04 09:40:34.858 info 8704 --- [ restartedmain] o.s.b.w.embedded.tomcat.tomcatwebserver : tomcat started on port(s): 8080 (http) with context path ''
2022-05-04 09:40:34.880 info 8704 --- [ restartedmain] c.t.s.springbootormapplication : started springbootormapplication in 8.222 seconds (jvm running for 9.564)
2022-05-04 09:41:08.718 info 8704 --- [nio-8080-exec-2] o.a.c.c.c.[tomcat].[localhost].[/] : initializing spring dispatcherservlet 'dispatcherservlet'
2022-05-04 09:41:08.718 info 8704 --- [nio-8080-exec-2] o.s.web.servlet.dispatcherservlet : initializing servlet 'dispatcherservlet'
2022-05-04 09:41:08.722 info 8704 --- [nio-8080-exec-2] o.s.web.servlet.dispatcherservlet : completed initialization in 4 ms
服务器启动并运行后,使用 apifox 发出 post 请求以首先添加记录。
在 apifox 中设置以下参数。
http://localhost:8080/emp/employee
{
"age": "35",
"name": "julie",
"email": "julie@gmail.com"
}
单击发送按钮并检查响应状态是否正常。 现在发出 get 请求以获取所有记录。
在 apifox 中设置以下参数。
http://localhost:8080/emp/employees
单击发送按钮并验证响应。
[{
"id": 1,
"age": 35,
"name": "julie",
"email": "julie@gmail.com"
}]