Skip to content

Commit

Permalink
Merge pull request #77 from oracle-quickstart/fulfillment-to-micronaut-4
Browse files Browse the repository at this point in the history
Upgrading the fulfillment service to micronaut 4.3.4
  • Loading branch information
ChaimaaeROUAI authored Apr 17, 2024
2 parents 346b3f5 + 69aabf0 commit de18b35
Show file tree
Hide file tree
Showing 19 changed files with 601 additions and 582 deletions.
172 changes: 96 additions & 76 deletions src/fulfillment/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,76 +1,96 @@
plugins {
id("groovy")
id("com.github.johnrengelman.shadow") version "7.1.2"
id("io.micronaut.application") version "3.6.2"
}

group = "micronaut.mushop"

repositories {
mavenCentral()
}

micronaut {
runtime("netty")
testRuntime("spock2")
processing {
incremental(true)
annotations("mushop.*")
}
}

dependencies {
annotationProcessor("io.micronaut.micrometer:micronaut-micrometer-annotation")
annotationProcessor("io.micronaut.openapi:micronaut-openapi")

implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-runtime")
implementation("io.micronaut:micronaut-validation")

// Metrics
implementation("io.micronaut:micronaut-management")
implementation("io.micronaut.micrometer:micronaut-micrometer-core")
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-prometheus")

// Tracing
implementation("io.micronaut.tracing:micronaut-tracing-core")
implementation("io.micronaut.tracing:micronaut-tracing-zipkin")

// NATS
implementation("io.micronaut.nats:micronaut-nats")

// Swagger
implementation("io.swagger.core.v3:swagger-annotations")

runtimeOnly("ch.qos.logback:logback-classic")

testImplementation(project(":tck"))
testImplementation("org.testcontainers:testcontainers")
}

application {
mainClass.set("mushop.Application")
}

java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}

if (javaBaseImage == "graalvm") {
dockerfile {
baseImage = "ghcr.io/graalvm/graalvm-ce:ol8-java11-21.1.0"
}
}

dockerBuild {
images = ["phx.ocir.io/oraclelabs/micronaut-showcase/mushop/$project.parent.name-$project.name-${javaBaseImage}:$project.version"]
}

dockerBuildNative {
images = ["phx.ocir.io/oraclelabs/micronaut-showcase/mushop/${project.parent.name}-${project.name}-native:$project.version"]
}

dockerfileNative {
instruction "RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.11/main' >> /etc/apk/repositories && apk update && apk add 'zlib<1.2.12'"
}
plugins {
id("groovy")
id("com.github.johnrengelman.shadow") version "8.1.1"
id("io.micronaut.application") version "4.3.4"
id("io.micronaut.aot") version "4.3.4"
id("io.micronaut.test-resources") version "4.3.4"
}

group = "micronaut.mushop"

repositories {
mavenCentral()
}

micronaut {
runtime("netty")
testRuntime("spock2")
processing {
incremental(true)
annotations("mushop.*")
}
aot {
optimizeServiceLoading = false
convertYamlToJava = false
precomputeOperations = true
cacheEnvironment = true
optimizeClassLoading = true
deduceEnvironment = true
optimizeNetty = true
}
}

dependencies {
annotationProcessor("io.micronaut.micrometer:micronaut-micrometer-annotation")
annotationProcessor("io.micronaut.openapi:micronaut-openapi")
annotationProcessor("io.micronaut.serde:micronaut-serde-processor")
annotationProcessor("io.micronaut.validation:micronaut-validation-processor")

implementation("io.micronaut:micronaut-retry")
implementation("io.micronaut.serde:micronaut-serde-jackson")
implementation("io.micronaut:micronaut-http-client")
implementation("io.micronaut:micronaut-runtime")
implementation("io.micronaut.validation:micronaut-validation")

// Metrics
implementation("io.micronaut:micronaut-management")
implementation("io.micronaut.micrometer:micronaut-micrometer-core")
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-prometheus")

// Tracing
implementation("io.micronaut.tracing:micronaut-tracing-core")
implementation("io.micronaut.tracing:micronaut-tracing-brave")
implementation("io.micronaut.tracing:micronaut-tracing-brave-http")

// NATS
implementation("io.micronaut.nats:micronaut-nats")

// Swagger
implementation("io.swagger.core.v3:swagger-annotations")

compileOnly("io.micronaut:micronaut-http-client")
compileOnly("io.micronaut:micronaut-http-validation")
compileOnly("io.micronaut.serde:micronaut-serde-processor")

runtimeOnly("ch.qos.logback:logback-classic")
runtimeOnly("org.yaml:snakeyaml")

testImplementation(project(":tck"))
}

application {
mainClass.set("mushop.Application")
}

java {
sourceCompatibility = JavaVersion.toVersion("21")
targetCompatibility = JavaVersion.toVersion("21")
}

if (javaBaseImage == "graalvm") {
dockerfile {
baseImage = "ghcr.io/graalvm/native-image-community:21"
}
}

dockerBuild {
images = ["phx.ocir.io/oraclelabs/micronaut-showcase/mushop/$project.parent.name-$project.name-${javaBaseImage}:$project.version"]
}

dockerBuildNative {
images = ["phx.ocir.io/oraclelabs/micronaut-showcase/mushop/${project.parent.name}-${project.name}-native:$project.version"]
}

dockerfileNative {
instruction "RUN echo 'http://dl-cdn.alpinelinux.org/alpine/v3.11/main' >> /etc/apk/repositories && apk update && apk add 'zlib<1.2.12'"
}
86 changes: 43 additions & 43 deletions src/fulfillment/app/src/main/java/mushop/OrderUpdate.java
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
/**
** Copyright © 2020, Oracle and/or its affiliates. All rights reserved.
** Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
**/
package mushop;

import io.micronaut.core.annotation.Introspected;
import io.micronaut.core.annotation.Nullable;

/**
* The messaging business object.
*/
@Introspected
public class OrderUpdate {

private final Long orderId;
private Shipment shipment;

public OrderUpdate(Long orderId, @Nullable Shipment shipment) {
this.orderId = orderId;
this.shipment = shipment;
}

public Long getOrderId() {
return orderId;
}

public Shipment getShipment() {
return shipment;
}

public void setShipment(Shipment shipment) {
this.shipment = shipment;
}

@Override
public String toString() {
return "OrderUpdate{" +
"orderId='" + orderId + '\'' +
", shipment=" + shipment +
'}';
}
}
/**
** Copyright © 2020, Oracle and/or its affiliates. All rights reserved.
** Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
**/
package mushop;

import io.micronaut.serde.annotation.Serdeable;
import io.micronaut.core.annotation.Nullable;

/**
* The messaging business object.
*/
@Serdeable
public class OrderUpdate {

private final Long orderId;
private Shipment shipment;

public OrderUpdate(Long orderId, @Nullable Shipment shipment) {
this.orderId = orderId;
this.shipment = shipment;
}

public Long getOrderId() {
return orderId;
}

public Shipment getShipment() {
return shipment;
}

public void setShipment(Shipment shipment) {
this.shipment = shipment;
}

@Override
public String toString() {
return "OrderUpdate{" +
"orderId='" + orderId + '\'' +
", shipment=" + shipment +
'}';
}
}
76 changes: 38 additions & 38 deletions src/fulfillment/app/src/main/java/mushop/Shipment.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
/**
** Copyright © 2020, Oracle and/or its affiliates. All rights reserved.
** Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
**/
package mushop;

import io.micronaut.core.annotation.Introspected;

/**
* The messaging business object.
*/
@Introspected
public class Shipment {

private final String id;
private final String name;

public Shipment(String id, String name) {
this.id = id;
this.name = name;
}

public String getId() {
return id;
}

public String getName() {
return name;
}

@Override
public String toString() {
return "Shipment{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
'}';
}
}
/**
** Copyright © 2020, Oracle and/or its affiliates. All rights reserved.
** Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
**/
package mushop;

import io.micronaut.serde.annotation.Serdeable;

/**
* The messaging business object.
*/
@Serdeable
public class Shipment {

private final String id;
private final String name;

public Shipment(String id, String name) {
this.id = id;
this.name = name;
}

public String getId() {
return id;
}

public String getName() {
return name;
}

@Override
public String toString() {
return "Shipment{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
'}';
}
}
Loading

0 comments on commit de18b35

Please sign in to comment.