- Spring Boot ORM 教程
- Spring Boot ORM - 主页
- Spring Boot ORM - 概述
- 环境设置
- Spring Boot ORM 和 Spring Data JPA
- Spring Boot ORM - 创建项目
- 应用程序属性
- Spring Boot ORM - 更新项目
- Spring Boot ORM - 测试 Hibernate
- Spring Boot ORM 和 EclipseLink
- Maven EclipseLink
- 更新项目 EclipseLink
- Spring Boot ORM - 测试 EclipseLink
- Spring Boot ORM 有用资源
- Spring Boot ORM - 快速指南
- Spring Boot ORM - 有用的资源
- Spring Boot ORM - 讨论
Spring Boot ORM - 测试 Hibernate
现在在 Eclipse 中,右键单击 SpringBootOrmApplication.java,选择Run As context -
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.5.5) 2021-10-05 09:40:27.442 INFO 8704 --- [ restartedMain] c.t.s.SpringBootOrmApplication : Starting SpringBootOrmApplication using Java 11.0.11 on ... 2021-10-05 09:40:34.775 INFO 8704 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2021-10-05 09:40:34.858 INFO 8704 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2021-10-05 09:40:34.880 INFO 8704 --- [ restartedMain] c.t.s.SpringBootOrmApplication : Started SpringBootOrmApplication in 8.222 seconds (JVM running for 9.564) 2021-10-05 09:41:08.718 INFO 8704 --- [nio-8080-exec-2] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2021-10-05 09:41:08.718 INFO 8704 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2021-10-05 09:41:08.722 INFO 8704 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed initialization in 4 ms
服务器启动并运行后,首先使用 Postman 发出 POST 请求来添加记录。
在 POSTMAN 中设置以下参数。
HTTP 方法 - POST
URL - http://localhost:8080/emp/employee
BODY -员工 JSON
{ "age": "35", "name": "Julie", "email": "julie@gmail.com" }
单击发送按钮并检查响应状态是否正常。现在发出 GET 请求来获取所有记录。
在 POSTMAN 中设置以下参数。
HTTP 方法 - GET
URL - http://localhost:8080/emp/employees
单击发送按钮并验证响应。
[{ "id": 1, "age": 35, "name": "Julie", "email": "julie@gmail.com" }]