-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #76 from oracle-quickstart/assets-to-micronaut4
Upgrading the assets service to Micronaut version 4
- Loading branch information
Showing
12 changed files
with
331 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,82 +1,101 @@ | ||
plugins { | ||
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("junit5") | ||
processing { | ||
incremental(true) | ||
annotations("assets.*") | ||
} | ||
} | ||
|
||
dependencies { | ||
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") | ||
|
||
implementation("io.swagger.core.v3:swagger-annotations") | ||
|
||
implementation("io.micronaut.objectstorage:micronaut-object-storage-core:1.1.0") | ||
|
||
runtimeOnly("ch.qos.logback:logback-classic") | ||
|
||
testImplementation(project(":tck")) | ||
} | ||
|
||
application { | ||
mainClass.set("assets.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"] | ||
} | ||
|
||
processResources { | ||
def assetPaths = [] | ||
eachFile {details -> | ||
if (details.path.contains("assets")) { | ||
assetPaths << details.path.minus("assets/") | ||
} | ||
} | ||
doLast { | ||
File assetsFile = new File("$destinationDir/assets/manifest.txt") | ||
assetsFile.withWriter{ out -> | ||
assetPaths.each {out.println it} | ||
} | ||
} | ||
} | ||
plugins { | ||
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" | ||
} | ||
|
||
group = "micronaut.mushop" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
micronaut { | ||
runtime("netty") | ||
testRuntime("junit5") | ||
processing { | ||
incremental(true) | ||
annotations("assets.*") | ||
} | ||
aot { | ||
optimizeServiceLoading = false | ||
convertYamlToJava = false | ||
precomputeOperations = true | ||
cacheEnvironment = true | ||
optimizeClassLoading = true | ||
deduceEnvironment = true | ||
optimizeNetty = true | ||
} | ||
} | ||
|
||
dependencies { | ||
annotationProcessor("io.micronaut.openapi:micronaut-openapi") | ||
annotationProcessor("io.micronaut:micronaut-http-validation") | ||
annotationProcessor("io.micronaut.serde:micronaut-serde-processor") | ||
annotationProcessor("io.micronaut.tracing:micronaut-tracing-opentelemetry-annotation") | ||
annotationProcessor("io.micronaut.validation:micronaut-validation-processor") | ||
|
||
implementation("io.micronaut:micronaut-http-client") | ||
implementation("io.micronaut.serde:micronaut-serde-jackson") | ||
implementation("io.micronaut.validation:micronaut-validation") | ||
implementation("jakarta.validation:jakarta.validation-api") | ||
|
||
// 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-opentelemetry-http") | ||
implementation("io.opentelemetry:opentelemetry-exporter-zipkin") | ||
|
||
implementation("io.swagger.core.v3:swagger-annotations") | ||
|
||
implementation("io.micronaut.objectstorage:micronaut-object-storage-core") | ||
|
||
compileOnly("io.micronaut.openapi:micronaut-openapi-annotations") | ||
|
||
runtimeOnly("ch.qos.logback:logback-classic") | ||
runtimeOnly("org.yaml:snakeyaml") | ||
|
||
testImplementation(project(":tck")) | ||
} | ||
|
||
application { | ||
mainClass.set("assets.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"] | ||
} | ||
|
||
processResources { | ||
def assetPaths = [] | ||
eachFile {details -> | ||
if (details.path.contains("assets")) { | ||
assetPaths << details.path.minus("assets/") | ||
} | ||
} | ||
doLast { | ||
File assetsFile = new File("$destinationDir/assets/manifest.txt") | ||
assetsFile.withWriter{ out -> | ||
assetPaths.each {out.println it} | ||
} | ||
} | ||
} |
34 changes: 17 additions & 17 deletions
34
src/assets/app/src/main/java/assets/controllers/AssetLocationDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
package assets.controllers; | ||
|
||
import io.micronaut.core.annotation.Introspected; | ||
|
||
@Introspected | ||
public class AssetLocationDTO { | ||
|
||
private final String productImagePath; | ||
|
||
public AssetLocationDTO(String productImagePath) { | ||
this.productImagePath = productImagePath; | ||
} | ||
|
||
public String getProductImagePath() { | ||
return productImagePath; | ||
} | ||
} | ||
package assets.controllers; | ||
|
||
import io.micronaut.serde.annotation.Serdeable; | ||
|
||
@Serdeable | ||
public class AssetLocationDTO { | ||
|
||
private final String productImagePath; | ||
|
||
public AssetLocationDTO(String productImagePath) { | ||
this.productImagePath = productImagePath; | ||
} | ||
|
||
public String getProductImagePath() { | ||
return productImagePath; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
<configuration> | ||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<withJansi>true</withJansi> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="info"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> | ||
<configuration> | ||
|
||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> | ||
<!-- encoders are assigned the type | ||
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default --> | ||
<encoder> | ||
<pattern>%cyan(%d{HH:mm:ss.SSS}) %gray([%thread]) %highlight(%-5level) %magenta(%logger{36}) - %msg%n</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<root level="info"> | ||
<appender-ref ref="STDOUT" /> | ||
</root> | ||
</configuration> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,72 @@ | ||
plugins { | ||
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("junit5") | ||
processing { | ||
incremental(true) | ||
annotations("assets.*") | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":app")) | ||
|
||
// Authentication | ||
implementation("software.amazon.awssdk:sts") | ||
|
||
// Configuration discovery | ||
implementation("io.micronaut.aws:micronaut-aws-parameter-store") | ||
|
||
// Metrics | ||
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-cloudwatch") | ||
|
||
// Object Storage | ||
implementation("io.micronaut.aws:micronaut-aws-sdk-v2") | ||
implementation("io.micronaut.objectstorage:micronaut-object-storage-aws:1.1.0") | ||
|
||
testImplementation(project(":tck")) | ||
testImplementation("org.mockito:mockito-core") | ||
} | ||
|
||
application { | ||
mainClass.set("assets.AwsApplication") | ||
} | ||
|
||
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"] | ||
} | ||
plugins { | ||
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" | ||
} | ||
|
||
group = "micronaut.mushop" | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
micronaut { | ||
runtime("netty") | ||
testRuntime("junit5") | ||
processing { | ||
incremental(true) | ||
annotations("assets.*") | ||
} | ||
aot { | ||
optimizeServiceLoading = false | ||
convertYamlToJava = false | ||
precomputeOperations = true | ||
cacheEnvironment = true | ||
optimizeClassLoading = true | ||
deduceEnvironment = true | ||
optimizeNetty = true | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation(project(":app")) | ||
|
||
// Authentication | ||
implementation("software.amazon.awssdk:sts") | ||
|
||
// Configuration discovery | ||
implementation("io.micronaut.aws:micronaut-aws-parameter-store") | ||
|
||
// Metrics | ||
implementation("io.micronaut.micrometer:micronaut-micrometer-registry-cloudwatch") | ||
|
||
// Object Storage | ||
implementation("io.micronaut.aws:micronaut-aws-sdk-v2") | ||
implementation("io.micronaut.objectstorage:micronaut-object-storage-aws") | ||
|
||
testImplementation(project(":tck")) | ||
testImplementation("org.mockito:mockito-core") | ||
} | ||
|
||
application { | ||
mainClass.set("assets.AwsApplication") | ||
} | ||
|
||
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"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
micronautVersion=3.7.3 | ||
version=2.0.0-SNAPSHOT | ||
javaBaseImage=graalvm | ||
micronautVersion=4.3.4 | ||
version=2.0.0-SNAPSHOT | ||
javaBaseImage=graalvm |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.