
- Spring Boot ORM 教程
- Spring Boot ORM - 主頁
- Spring Boot ORM - 概述
- 環境設定
- Spring Boot ORM - JPA
- Spring Boot ORM 和 Spring Data JPA
- Spring Boot ORM - 建立專案
- Application.properties
- 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 - 測試 EclipseLink
現在在 STS 中,右擊 springbootorm 專案,選擇 執行 as -> Spring Boot App 上下文 -
輸出
您將在 STS 控制檯中看到類似的結果。
. ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ [32m :: Spring Boot :: [39m [2m (v3.3.3)[0;39m [2m2024-08-29T09:27:56.504+05:30[0;39m [32m INFO[0;39m [35m4004[0;39m [2m---[0;39m [2m[springbootorm] [ restartedMain][0;39m [2m[0;39m[36mc.t.s.SpringbootormApplication [0;39m [2m:[0;39m Starting SpringbootormApplication using Java 21.0.3 with PID 4004 (E:\springbootorm\target\classes started by Tutorialspoint in E:\springbootorm) ... [EL Config]: metadata: 2024-08-29 09:28:00.503--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--The alias name for the entity class [class com.tutorialspoint.springbootorm.entity.Employee] is being defaulted to: Employee. [EL Config]: metadata: 2024-08-29 09:28:00.508--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--The table name for entity [class com.tutorialspoint.springbootorm.entity.Employee] is being defaulted to: EMPLOYEE. [EL Config]: metadata: 2024-08-29 09:28:00.528--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--The column name for element [name] is being defaulted to: NAME. [EL Config]: metadata: 2024-08-29 09:28:00.533--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--The column name for element [id] is being defaulted to: ID. [EL Config]: metadata: 2024-08-29 09:28:00.534--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--The column name for element [age] is being defaulted to: AGE. [EL Config]: metadata: 2024-08-29 09:28:00.535--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--The column name for element [email] is being defaulted to: EMAIL. [EL Finer]: metamodel: 2024-08-29 09:28:00.567--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--Canonical Metamodel class [com.tutorialspoint.springbootorm.entity.Employee_] not found during initialization. [2m2024-08-29T09:28:00.568+05:30[0;39m [32m INFO[0;39m [35m4004[0;39m [2m---[0;39m [2m[springbootorm] [ restartedMain][0;39m [2m[0;39m[36mj.LocalContainerEntityManagerFactoryBean[0;39m [2m:[0;39m Initialized JPA EntityManagerFactory for persistence unit 'default' [EL Finer]: 2024-08-29 09:28:00.634--Thread(Thread[#38,restartedMain,5,main])--initializing session manager [EL Info]: 2024-08-29 09:28:00.638--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--EclipseLink, version: Eclipse Persistence Services - 4.0.4.v202407190748-059428cdd2583c46f1f3e50d235854840a6fa9a7 [EL Fine]: connection: 2024-08-29 09:28:01.166--Thread(Thread[#38,restartedMain,5,main])--Detected database platform: org.eclipse.persistence.platform.database.MySQLPlatform [EL Fine]: connection: 2024-08-29 09:28:01.179--ServerSession(46117356)--Connection(2116562590)--Thread(Thread[#38,restartedMain,5,main])--connecting(DatabaseLogin( platform=>MySQLPlatform user name=> "" connector=>JNDIConnector datasource name=>null )) [EL Config]: connection: 2024-08-29 09:28:01.225--ServerSession(46117356)--Connection(1122916129)--Thread(Thread[#38,restartedMain,5,main])--Connected: jdbc:mysql://:3306/tutorialspoint User: root@localhost Database: MySQL Version: 8.0.39 Driver: MySQL Connector/J Version: mysql-connector-j-8.3.0 (Revision: 805f872a57875f311cb82487efcfb070411a3fa0) [EL Fine]: connection: 2024-08-29 09:28:01.226--ServerSession(46117356)--Connection(610477732)--Thread(Thread[#38,restartedMain,5,main])--connecting(DatabaseLogin( platform=>MySQLPlatform user name=> "" connector=>JNDIConnector datasource name=>null )) [EL Config]: connection: 2024-08-29 09:28:01.253--ServerSession(46117356)--Connection(1814465297)--Thread(Thread[#38,restartedMain,5,main])--Connected: jdbc:mysql://:3306/tutorialspoint User: root@localhost Database: MySQL Version: 8.0.39 Driver: MySQL Connector/J Version: mysql-connector-j-8.3.0 (Revision: 805f872a57875f311cb82487efcfb070411a3fa0) [EL Fine]: connection: 2024-08-29 09:28:01.29--ServerSession(46117356)--Thread(Thread[#38,restartedMain,5,main])--/file:/E:/springbootorm/target/classes/_default login successful ... [2m2024-08-29T09:28:02.343+05:30[0;39m [32m INFO[0;39m [35m4004[0;39m [2m---[0;39m [2m[springbootorm] [ restartedMain][0;39m [2m[0;39m[36mo.s.b.d.a.OptionalLiveReloadServer [0;39m [2m:[0;39m LiveReload server is running on port 35729 [2m2024-08-29T09:28:02.377+05:30[0;39m [32m INFO[0;39m [35m4004[0;39m [2m---[0;39m [2m[springbootorm] [ restartedMain][0;39m [2m[0;39m[36mo.s.b.w.embedded.tomcat.TomcatWebServer [0;39m [2m:[0;39m Tomcat started on port 8080 (http) with context path '/' [2m2024-08-29T09:28:02.385+05:30[0;39m [32m INFO[0;39m [35m4004[0;39m [2m---[0;39m [2m[springbootorm] [ restartedMain][0;39m [2m[0;39m[36mc.t.s.SpringbootormApplication [0;39m [2m:[0;39m Started SpringbootormApplication in 6.895 seconds (process running for 8.546)
獲取所有員工
現在進行 GET 請求以獲取所有記錄。
在 POSTMAN 中設定以下引數。
HTTP 方法 - GET
URL - https://:8080/emp/employees
單擊發送按鈕並驗證響應。
[{ "id": 1, "age": 35, "name": "Julie", "email": "julie@gmail.com" }]

您還將在 STS 控制檯中看到類似的更新。
[EL Finer]: connection: 2024-08-29 09:31:20.416--ServerSession(46117356)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--client acquired: 1215821283 [EL Finer]: transaction: 2024-08-29 09:31:20.43--ClientSession(1215821283)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--acquire unit of work: 2007319936 [EL Finer]: transaction: 2024-08-29 09:31:20.498--UnitOfWork(2007319936)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--begin unit of work flush [EL Finer]: transaction: 2024-08-29 09:31:20.498--UnitOfWork(2007319936)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--end unit of work flush [EL Fine]: sql: 2024-08-29 09:31:20.55--ServerSession(46117356)--Connection(135997463)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--SELECT ID, AGE, EMAIL, NAME FROM EMPLOYEE [EL Finer]: transaction: 2024-08-29 09:31:20.599--UnitOfWork(2007319936)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--begin unit of work commit [EL Finer]: transaction: 2024-08-29 09:31:20.599--UnitOfWork(2007319936)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--end unit of work commit [EL Finer]: transaction: 2024-08-29 09:31:20.599--UnitOfWork(2007319936)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--resume unit of work [EL Finer]: transaction: 2024-08-29 09:31:20.731--UnitOfWork(2007319936)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--release unit of work [EL Finer]: connection: 2024-08-29 09:31:20.731--ClientSession(1215821283)--Thread(Thread[#50,http-nio-8080-exec-1,5,main])--client released
廣告