From c67805e3ead56b3c628cedab32d6bb3485987138 Mon Sep 17 00:00:00 2001
From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com>
Date: Mon, 29 Apr 2024 15:33:00 +0000
Subject: [PATCH 1/4] Update dependency io.micronaut:micronaut-inject-java to
v4
---
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pom.xml b/pom.xml
index a5423c3..32b568f 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
pom
- 3.10.4
+ 4.4.7
19
${jdk.version}
piomin_sample-micronaut-microservices
From 88fad0539939b3550bf566cd2085b723106548f8 Mon Sep 17 00:00:00 2001
From: piomin
Date: Tue, 30 Apr 2024 23:23:11 +0200
Subject: [PATCH 2/4] fix micronaut version
---
department-service/pom.xml | 7 ++++++-
employee-service/pom.xml | 7 ++++++-
organization-service/pom.xml | 7 ++++++-
pom.xml | 28 ++++++++++++++--------------
4 files changed, 32 insertions(+), 17 deletions(-)
diff --git a/department-service/pom.xml b/department-service/pom.xml
index d8ade35..add9987 100644
--- a/department-service/pom.xml
+++ b/department-service/pom.xml
@@ -20,6 +20,11 @@
io.micronaut
micronaut-http-server-netty
+
+ io.micronaut.serde
+ micronaut-serde-jackson
+ compile
+
io.micronaut
micronaut-http-client
@@ -34,7 +39,7 @@
io.micronaut.tracing
- micronaut-tracing-zipkin
+ micronaut-tracing-brave-http
io.micronaut.discovery
diff --git a/employee-service/pom.xml b/employee-service/pom.xml
index 2a2c733..71e6dcc 100644
--- a/employee-service/pom.xml
+++ b/employee-service/pom.xml
@@ -20,6 +20,11 @@
io.micronaut
micronaut-http-server-netty
+
+ io.micronaut.serde
+ micronaut-serde-jackson
+ compile
+
io.micronaut
micronaut-inject
@@ -34,7 +39,7 @@
io.micronaut.tracing
- micronaut-tracing-zipkin
+ micronaut-tracing-brave-http
io.micronaut.discovery
diff --git a/organization-service/pom.xml b/organization-service/pom.xml
index 806ac29..8ca03ad 100644
--- a/organization-service/pom.xml
+++ b/organization-service/pom.xml
@@ -20,6 +20,11 @@
io.micronaut
micronaut-http-server-netty
+
+ io.micronaut.serde
+ micronaut-serde-jackson
+ compile
+
io.micronaut
micronaut-http-client
@@ -38,7 +43,7 @@
io.micronaut.tracing
- micronaut-tracing-zipkin
+ micronaut-tracing-brave-http
io.micronaut.discovery
diff --git a/pom.xml b/pom.xml
index 32b568f..c39b483 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,9 +5,9 @@
4.0.0
- io.micronaut
+ io.micronaut.platform
micronaut-parent
- 3.10.4
+ 4.4.1
pl.piomin.services
@@ -16,7 +16,7 @@
pom
- 4.4.7
+ 4.4.1
19
${jdk.version}
piomin_sample-micronaut-microservices
@@ -31,17 +31,17 @@
organization-service
-
-
-
- io.micronaut
- micronaut-bom
- ${micronaut.version}
- pom
- import
-
-
-
+
+
+
+
+
+
+
+
+
+
+
From 6e974d686affe32ad1b1c768ce4e77100073a6b8 Mon Sep 17 00:00:00 2001
From: piomin
Date: Tue, 30 Apr 2024 23:33:37 +0200
Subject: [PATCH 3/4] adding serdeable
---
department-service/pom.xml | 11 +++++++++++
.../controller/DepartmentController.java | 9 ++++++---
.../services/department/model/Department.java | 2 ++
employee-service/pom.xml | 11 +++++++++++
.../services/employee/model/Employee.java | 2 ++
organization-service/pom.xml | 11 +++++++++++
.../controller/OrganizationController.java | 18 ++++++++++--------
.../organization/model/Organization.java | 2 ++
8 files changed, 55 insertions(+), 11 deletions(-)
diff --git a/department-service/pom.xml b/department-service/pom.xml
index add9987..bddd083 100644
--- a/department-service/pom.xml
+++ b/department-service/pom.xml
@@ -117,6 +117,17 @@
micronaut-openapi
${micronaut.openapi.version}
+
+ io.micronaut.serde
+ micronaut-serde-processor
+ ${micronaut.serialization.version}
+
+
+ io.micronaut
+ micronaut-inject
+
+
+
-Amicronaut.processing.group=pl.piomin.services
diff --git a/department-service/src/main/java/pl/piomin/services/department/controller/DepartmentController.java b/department-service/src/main/java/pl/piomin/services/department/controller/DepartmentController.java
index 15d76dd..a1f2d79 100644
--- a/department-service/src/main/java/pl/piomin/services/department/controller/DepartmentController.java
+++ b/department-service/src/main/java/pl/piomin/services/department/controller/DepartmentController.java
@@ -20,11 +20,14 @@ public class DepartmentController {
private static final Logger LOGGER = LoggerFactory.getLogger(DepartmentController.class);
- @Inject
DepartmentRepository repository;
- @Inject
EmployeeClient employeeClient;
-
+
+ public DepartmentController(DepartmentRepository repository, EmployeeClient employeeClient) {
+ this.repository = repository;
+ this.employeeClient = employeeClient;
+ }
+
@Post
public Department add(@Body Department department) {
LOGGER.info("Department add: {}", department);
diff --git a/department-service/src/main/java/pl/piomin/services/department/model/Department.java b/department-service/src/main/java/pl/piomin/services/department/model/Department.java
index 04ca0e1..a2f6037 100644
--- a/department-service/src/main/java/pl/piomin/services/department/model/Department.java
+++ b/department-service/src/main/java/pl/piomin/services/department/model/Department.java
@@ -1,5 +1,6 @@
package pl.piomin.services.department.model;
+import io.micronaut.serde.annotation.Serdeable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -12,6 +13,7 @@
@Setter
@ToString
@NoArgsConstructor
+@Serdeable
public class Department {
private Long id;
diff --git a/employee-service/pom.xml b/employee-service/pom.xml
index 71e6dcc..7232abb 100644
--- a/employee-service/pom.xml
+++ b/employee-service/pom.xml
@@ -113,6 +113,17 @@
micronaut-openapi
${micronaut.openapi.version}
+
+ io.micronaut.serde
+ micronaut-serde-processor
+ ${micronaut.serialization.version}
+
+
+ io.micronaut
+ micronaut-inject
+
+
+
-Amicronaut.processing.group=pl.piomin.services
diff --git a/employee-service/src/main/java/pl/piomin/services/employee/model/Employee.java b/employee-service/src/main/java/pl/piomin/services/employee/model/Employee.java
index 46f3d4e..286d2fd 100644
--- a/employee-service/src/main/java/pl/piomin/services/employee/model/Employee.java
+++ b/employee-service/src/main/java/pl/piomin/services/employee/model/Employee.java
@@ -1,5 +1,6 @@
package pl.piomin.services.employee.model;
+import io.micronaut.serde.annotation.Serdeable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -9,6 +10,7 @@
@Setter
@ToString
@NoArgsConstructor
+@Serdeable
public class Employee {
private Long id;
diff --git a/organization-service/pom.xml b/organization-service/pom.xml
index 8ca03ad..1d67138 100644
--- a/organization-service/pom.xml
+++ b/organization-service/pom.xml
@@ -117,6 +117,17 @@
micronaut-openapi
${micronaut.openapi.version}
+
+ io.micronaut.serde
+ micronaut-serde-processor
+ ${micronaut.serialization.version}
+
+
+ io.micronaut
+ micronaut-inject
+
+
+
-Amicronaut.processing.group=pl.piomin.services
diff --git a/organization-service/src/main/java/pl/piomin/services/organization/controller/OrganizationController.java b/organization-service/src/main/java/pl/piomin/services/organization/controller/OrganizationController.java
index 90e09b0..2bedbd0 100644
--- a/organization-service/src/main/java/pl/piomin/services/organization/controller/OrganizationController.java
+++ b/organization-service/src/main/java/pl/piomin/services/organization/controller/OrganizationController.java
@@ -4,7 +4,6 @@
import io.micronaut.http.annotation.Controller;
import io.micronaut.http.annotation.Get;
import io.micronaut.http.annotation.Post;
-import jakarta.inject.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import pl.piomin.services.organization.client.DepartmentClient;
@@ -19,13 +18,16 @@ public class OrganizationController {
private static final Logger LOGGER = LoggerFactory.getLogger(OrganizationController.class);
- @Inject
OrganizationRepository repository;
- @Inject
DepartmentClient departmentClient;
- @Inject
EmployeeClient employeeClient;
-
+
+ public OrganizationController(OrganizationRepository repository, DepartmentClient departmentClient, EmployeeClient employeeClient) {
+ this.repository = repository;
+ this.departmentClient = departmentClient;
+ this.employeeClient = employeeClient;
+ }
+
@Post
public Organization add(@Body Organization organization) {
LOGGER.info("Organization add: {}", organization);
@@ -46,7 +48,7 @@ public Organization findById(Long id) {
@Get("/{id}/with-departments")
public Organization findByIdWithDepartments(Long id) {
- LOGGER.info("Organization find: id={}", id);
+ LOGGER.info("Organization find with departments: id={}", id);
Organization organization = repository.findById(id);
organization.setDepartments(departmentClient.findByOrganization(organization.getId()));
return organization;
@@ -54,7 +56,7 @@ public Organization findByIdWithDepartments(Long id) {
@Get("/{id}/with-departments-and-employees")
public Organization findByIdWithDepartmentsAndEmployees(Long id) {
- LOGGER.info("Organization find: id={}", id);
+ LOGGER.info("Organization find with departments and employees: id={}", id);
Organization organization = repository.findById(id);
organization.setDepartments(departmentClient.findByOrganizationWithEmployees(organization.getId()));
return organization;
@@ -62,7 +64,7 @@ public Organization findByIdWithDepartmentsAndEmployees(Long id) {
@Get("/{id}/with-employees")
public Organization findByIdWithEmployees(Long id) {
- LOGGER.info("Organization find: id={}", id);
+ LOGGER.info("Organization find with employees: id={}", id);
Organization organization = repository.findById(id);
organization.setEmployees(employeeClient.findByOrganization(organization.getId()));
return organization;
diff --git a/organization-service/src/main/java/pl/piomin/services/organization/model/Organization.java b/organization-service/src/main/java/pl/piomin/services/organization/model/Organization.java
index 5ae244f..965ccd0 100644
--- a/organization-service/src/main/java/pl/piomin/services/organization/model/Organization.java
+++ b/organization-service/src/main/java/pl/piomin/services/organization/model/Organization.java
@@ -1,5 +1,6 @@
package pl.piomin.services.organization.model;
+import io.micronaut.serde.annotation.Serdeable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -12,6 +13,7 @@
@Setter
@ToString
@NoArgsConstructor
+@Serdeable
public class Organization {
private Long id;
From 299caad8d3cdb1cfd482f1213d0c60bd02b9aeea Mon Sep 17 00:00:00 2001
From: piomin
Date: Tue, 30 Apr 2024 23:37:51 +0200
Subject: [PATCH 4/4] adding serdeable (2)
---
.../java/pl/piomin/services/department/model/Employee.java | 2 ++
.../java/pl/piomin/services/organization/model/Department.java | 3 +++
.../java/pl/piomin/services/organization/model/Employee.java | 3 +++
3 files changed, 8 insertions(+)
diff --git a/department-service/src/main/java/pl/piomin/services/department/model/Employee.java b/department-service/src/main/java/pl/piomin/services/department/model/Employee.java
index 70caf4c..7ef59a5 100644
--- a/department-service/src/main/java/pl/piomin/services/department/model/Employee.java
+++ b/department-service/src/main/java/pl/piomin/services/department/model/Employee.java
@@ -1,5 +1,6 @@
package pl.piomin.services.department.model;
+import io.micronaut.serde.annotation.Serdeable;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
@@ -9,6 +10,7 @@
@Getter
@ToString
@NoArgsConstructor
+@Serdeable
public class Employee {
private Long id;
diff --git a/organization-service/src/main/java/pl/piomin/services/organization/model/Department.java b/organization-service/src/main/java/pl/piomin/services/organization/model/Department.java
index 678df32..1fcaad4 100644
--- a/organization-service/src/main/java/pl/piomin/services/organization/model/Department.java
+++ b/organization-service/src/main/java/pl/piomin/services/organization/model/Department.java
@@ -1,8 +1,11 @@
package pl.piomin.services.organization.model;
+import io.micronaut.serde.annotation.Serdeable;
+
import java.util.ArrayList;
import java.util.List;
+@Serdeable
public class Department {
private Long id;
diff --git a/organization-service/src/main/java/pl/piomin/services/organization/model/Employee.java b/organization-service/src/main/java/pl/piomin/services/organization/model/Employee.java
index 12c9a71..95dacf0 100644
--- a/organization-service/src/main/java/pl/piomin/services/organization/model/Employee.java
+++ b/organization-service/src/main/java/pl/piomin/services/organization/model/Employee.java
@@ -1,5 +1,8 @@
package pl.piomin.services.organization.model;
+import io.micronaut.serde.annotation.Serdeable;
+
+@Serdeable
public class Employee {
private Long id;