Web TX – Spring Boot 168 EP 5-4

Web TX 將把交易從 Service 抽離,獨立為單一類別,因內部調用 @Transactional 將不會有作用,加上交易隱含著鎖的概念,前置檢查、資料庫查詢等,將不寫在交易裡面,Spring Boot 168 EP 5-4 使用 Spring Data JPA 增加範例 ,並透過 JUnit 5 來驗證產出結果。

Continue ReadingWeb TX – Spring Boot 168 EP 5-4

HttpClient GggAPI – Spring Boot 168 EP 22-9

整合第三方 API 的 Service 後,HttpClient GggAPI 將提供 API 給外部調用,實作使用者是否存在、使用者登入等,輸入 API 參數,發送請求,取得 HTTP 200 回應,Spring Boot 168 EP 22-9 增加範例,並透過 Postman 來驗證產出結果。

Continue ReadingHttpClient GggAPI – Spring Boot 168 EP 22-9

HttpClient TX – Spring Boot 168 EP 22-7

建立第三方 API 的 Service 後,HttpClient TX 將把交易從 Service 抽離,獨立為單一類別,因內部調用 @Transactional 將不會有作用,加上交易隱含著鎖的概念,前置檢查、資料庫查詢等,將不寫在交易裡面,Spring Boot 168 EP 22-7 使用 Spring Data JPA 增加範例 ,並透過 JUnit 5 來驗證產出結果。

Continue ReadingHttpClient TX – Spring Boot 168 EP 22-7

HttpClient GggService – Spring Boot 168 EP 22-8

建立第三方 API 的 Service 後,HttpClient GggService 將整合 GggClient 、 UserService ,調用第三方檢查使用者是否存在,若不存在則建立第三方使用者,然後再調用使用者登入 API ,取得回應的 ErrorCode 、 Token 等資訊,Spring Boot 168 EP 22-8 增加範例,並透過 JUnit 5 來驗證產出結果。

Continue ReadingHttpClient GggService – Spring Boot 168 EP 22-8

HttpClient Service – Spring Boot 168 EP 22-6

建立第三方 API 的 Model、Repository 後,HttpClient Service 採分層架構設計,區分為表現層、邏輯層、及資料層,Service 的應用在於邏輯層,每層都有獨立職責,多層協同提供完整的功能,Spring Boot 168 EP 22-6 使用 Spring Data JPA 增加範例 ,並透過 JUnit 5 來驗證產出結果。

Continue ReadingHttpClient Service – Spring Boot 168 EP 22-6