Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency io.micronaut:micronaut-inject-java to v4 #67

Merged
merged 4 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion department-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http-server-netty</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut.serde</groupId>
<artifactId>micronaut-serde-jackson</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http-client</artifactId>
Expand All @@ -34,7 +39,7 @@
</dependency>
<dependency>
<groupId>io.micronaut.tracing</groupId>
<artifactId>micronaut-tracing-zipkin</artifactId>
<artifactId>micronaut-tracing-brave-http</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut.discovery</groupId>
Expand Down Expand Up @@ -112,6 +117,17 @@
<artifactId>micronaut-openapi</artifactId>
<version>${micronaut.openapi.version}</version>
</path>
<path>
<groupId>io.micronaut.serde</groupId>
<artifactId>micronaut-serde-processor</artifactId>
<version>${micronaut.serialization.version}</version>
<exclusions>
<exclusion>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
</exclusion>
</exclusions>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amicronaut.processing.group=pl.piomin.services</arg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,6 +13,7 @@
@Setter
@ToString
@NoArgsConstructor
@Serdeable
public class Department {

private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -9,6 +10,7 @@
@Getter
@ToString
@NoArgsConstructor
@Serdeable
public class Employee {

private Long id;
Expand Down
18 changes: 17 additions & 1 deletion employee-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http-server-netty</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut.serde</groupId>
<artifactId>micronaut-serde-jackson</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
Expand All @@ -34,7 +39,7 @@
</dependency>
<dependency>
<groupId>io.micronaut.tracing</groupId>
<artifactId>micronaut-tracing-zipkin</artifactId>
<artifactId>micronaut-tracing-brave-http</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut.discovery</groupId>
Expand Down Expand Up @@ -108,6 +113,17 @@
<artifactId>micronaut-openapi</artifactId>
<version>${micronaut.openapi.version}</version>
</path>
<path>
<groupId>io.micronaut.serde</groupId>
<artifactId>micronaut-serde-processor</artifactId>
<version>${micronaut.serialization.version}</version>
<exclusions>
<exclusion>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
</exclusion>
</exclusions>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amicronaut.processing.group=pl.piomin.services</arg>
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -9,6 +10,7 @@
@Setter
@ToString
@NoArgsConstructor
@Serdeable
public class Employee {

private Long id;
Expand Down
18 changes: 17 additions & 1 deletion organization-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http-server-netty</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut.serde</groupId>
<artifactId>micronaut-serde-jackson</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-http-client</artifactId>
Expand All @@ -38,7 +43,7 @@
</dependency>
<dependency>
<groupId>io.micronaut.tracing</groupId>
<artifactId>micronaut-tracing-zipkin</artifactId>
<artifactId>micronaut-tracing-brave-http</artifactId>
</dependency>
<dependency>
<groupId>io.micronaut.discovery</groupId>
Expand Down Expand Up @@ -112,6 +117,17 @@
<artifactId>micronaut-openapi</artifactId>
<version>${micronaut.openapi.version}</version>
</path>
<path>
<groupId>io.micronaut.serde</groupId>
<artifactId>micronaut-serde-processor</artifactId>
<version>${micronaut.serialization.version}</version>
<exclusions>
<exclusion>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-inject</artifactId>
</exclusion>
</exclusions>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Amicronaut.processing.group=pl.piomin.services</arg>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand All @@ -46,23 +48,23 @@ 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;
}

@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;
}

@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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package pl.piomin.services.organization.model;

import io.micronaut.serde.annotation.Serdeable;

@Serdeable
public class Employee {

private Long id;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -12,6 +13,7 @@
@Setter
@ToString
@NoArgsConstructor
@Serdeable
public class Organization {

private Long id;
Expand Down
28 changes: 14 additions & 14 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>io.micronaut</groupId>
<groupId>io.micronaut.platform</groupId>
<artifactId>micronaut-parent</artifactId>
<version>3.10.4</version>
<version>4.4.1</version>
</parent>

<groupId>pl.piomin.services</groupId>
Expand All @@ -16,7 +16,7 @@
<packaging>pom</packaging>

<properties>
<micronaut.version>3.10.4</micronaut.version>
<micronaut.version>4.4.1</micronaut.version>
<jdk.version>19</jdk.version>
<release.version>${jdk.version}</release.version>
<sonar.projectKey>piomin_sample-micronaut-microservices</sonar.projectKey>
Expand All @@ -31,17 +31,17 @@
<module>organization-service</module>
</modules>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.micronaut</groupId>
<artifactId>micronaut-bom</artifactId>
<version>${micronaut.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- <dependencyManagement>-->
<!-- <dependencies>-->
<!-- <dependency>-->
<!-- <groupId>io.micronaut</groupId>-->
<!-- <artifactId>micronaut-bom</artifactId>-->
<!-- <version>${micronaut.version}</version>-->
<!-- <type>pom</type>-->
<!-- <scope>import</scope>-->
<!-- </dependency>-->
<!-- </dependencies>-->
<!-- </dependencyManagement>-->

<build>
<plugins>
Expand Down