Skip to content

Commit

Permalink
Upgrade sample microservices to Java 17 and Spring Boot 3 (#399)
Browse files Browse the repository at this point in the history
* Update ms channel-operations example ca

* Update ms example-article ca

* update ms example-dynamo example ca

* update ms example-mongo example ca

* update ms example-r2dbc example ca

* update ms example-redis example ca

* update rest-consumer-client example ca

* update ms rest-consumer-server example ca

* update ms s3-example example ca

* update Dockerfile of sample microservices

* update ms example dependencies

* Add gradle-wrapper.properties to .gitignore file

* Update gradle task
  • Loading branch information
luisgomez29 authored Nov 29, 2023
1 parent a88edd9 commit 6aa578e
Show file tree
Hide file tree
Showing 149 changed files with 2,300 additions and 1,002 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,27 @@
apply plugin: 'org.springframework.boot'

dependencies {
implementation project(':r2postgresql')
implementation project(':reactive-web')
testImplementation 'com.fasterxml.jackson.core:jackson-databind'
testImplementation 'com.tngtech.archunit:archunit:1.1.0'
implementation project(':r2postgresql')
implementation project(':reactive-web')
implementation project(':model')
implementation project(':usecase')
compile 'org.springframework.boot:spring-boot-starter'
compile 'org.reactivecommons.utils:object-mapper:0.1.0'
runtime('org.springframework.boot:spring-boot-devtools')
implementation 'org.springframework.boot:spring-boot-starter'
runtimeOnly('org.springframework.boot:spring-boot-devtools')
}

task explodedJar(type: Copy) {
tasks.register('explodedJar', Copy) {
with jar
into "${buildDir}/exploded"
into layout.buildDirectory.dir("exploded")
}

jar {
// To disable the *-plain.jar
enabled = false
}

bootJar {
// Sets output jar name
archiveFileName = "${project.getParent().getName()}.${archiveExtension.get()}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;

@SpringBootApplication
@ConfigurationPropertiesScan
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
##Spring Configuration
server:
port: 8090
port: 8080
spring:
application:
name: r2dbcconnection
name: "channel-operations"
devtools:
add-properties: false
h2:
console:
enabled: true
path: /h2
profiles:
include:
include: "local"
logging:
level:
root: INFO
reactor:
netty: false

management:
endpoint:
health:
enabled: true
show-details: never
probes:
enabled: true
endpoints:
web:
exposure:
include: "health, liveness, readiness"
base-path: /
path-mapping:
health: "health"
liveness: "liveness"
readiness: "readiness"

adapters:
postgres:
database: "channel"
host: "localhost"
port: 5432
username: "postgres"
password: "admin"
schema: "management"
pool:
initial-size: 12
max-size: 15
max-idle-time: 10
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ appender.console.type=Console
appender.console.name=STDOUT
appender.console.layout.type=PatternLayout
appender.console.layout.pattern=[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
rootLogger.level=debug
rootLogger.level=INFO
rootLogger.appenderRefs=stdout
rootLogger.appenderRef.stdout.ref=STDOUT
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ArchitectureTest.java
Utils.java
36 changes: 20 additions & 16 deletions examples-ca/channel-operations/build.gradle
Original file line number Diff line number Diff line change
@@ -1,31 +1,35 @@
buildscript {
ext {
cleanArchitectureVersion = '1.8.2'
springBootVersion = '2.3.8.RELEASE'
sonarVersion = '3.0'
jacocoVersion = '0.8.5'
}
ext {
cleanArchitectureVersion = '3.6.3'
springBootVersion = '3.1.5'
sonarVersion = '4.4.1.3373'
jacocoVersion = '0.8.11'
lombokVersion = '1.18.30'
mapstructVersion = '1.5.5.Final'
}
}

plugins {
id 'co.com.bancolombia.cleanArchitecture' version "${cleanArchitectureVersion}"
id 'org.springframework.boot' version "${springBootVersion}"
id 'org.sonarqube' version "${sonarVersion}"
id 'jacoco'
id 'co.com.bancolombia.cleanArchitecture' version "${cleanArchitectureVersion}"
id 'org.springframework.boot' version "${springBootVersion}" apply false
id 'org.sonarqube' version "${sonarVersion}"
id 'jacoco'
}

sonarqube {
sonar {
def modules = subprojects.projectDir.collect { "${it.toString().replace(project.projectDir.toString() + "/", "")}" }
properties {
property "sonar.sourceEnconding", "UTF-8"
property "sonar.modules", "applications/app-service," +
"domain/model, domain/usecase," +
"infrastructure/driven-adapters/*, infrastructure/entry-points/*"
property "sonar.sources", "src, deployment, build.gradle, applications/app-service/build.gradle"
property "sonar.modules", "${modules.join(',')}"
property "sonar.sources", "src,deployment,settings.gradle,main.gradle,build.gradle,${modules.collect { "${it}/build.gradle" }.join(',')}"
property "sonar.exclusions", "**/MainApplication.java"
property "sonar.test", "src/test"
property "sonar.java.binaries", ""
property "sonar.junit.reportsPath", ""
property "sonar.java.coveragePlugin", "jacoco"
property "sonar.coverage.jacoco.xmlReportPaths", "build/reports/jacoco/test/jacocoTestReport.xml"
property "sonar.externalIssuesReportPaths", "build/issues.json"
}
}
apply from: './main.gradle'

apply from: './main.gradle'
9 changes: 4 additions & 5 deletions examples-ca/channel-operations/deployment/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
FROM adoptopenjdk/openjdk8-openj9@sha256:75225e1550aab2a1c57c806d18ed301419cc6dcadb521effe7dc0652a160a3a1
FROM eclipse-temurin:17-jdk-alpine
VOLUME /tmp
COPY *.jar app.jar
RUN sh -c 'touch /app.jar'
ENV JAVA_OPTS=" -Xshareclasses:name=cacheapp,cacheDir=/cache,nonfatal -XX:+UseContainerSupport -XX:MaxRAMPercentage=70 -Djava.security.egd=file:/dev/./urandom"
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -jar /app.jar" ]
COPY channel-operations.jar app.jar
ENV JAVA_OPTS="-XX:+UseContainerSupport -XX:MaxRAMPercentage=70 -Djava.security.egd=file:/dev/./urandom"
ENTRYPOINT [ "/bin/sh", "-c", "/opt/java/openjdk/bin/java $JAVA_OPTS -jar /app.jar" ]
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package co.com.bancolombia.model;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
Expand All @@ -13,6 +14,7 @@
@NoArgsConstructor
public class Authentication implements Serializable {

@Serial
private static final long serialVersionUID = 569381541450405501L;

private Integer id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
import lombok.NoArgsConstructor;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class Constants {
public static final String A_SYSTEM_FAILURE_OCCURRED =
"Ocurrió una falla en el sistema,"
+ " estamos trabajando"
+ " para ofrecerte una solución lo más pronto posible. Si el error persiste comunícate al 018000912345.";
public final class Constants {
public static final String A_SYSTEM_FAILURE_OCCURRED =
"Ocurrió una falla en el sistema, estamos trabajando para ofrecerte una solución lo más pronto posible. " +
"Si el error persiste comunícate al 018000912345.";
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
@Getter
@RequiredArgsConstructor
public enum BusinessErrorMessage {
AUTHENTICATION_NOT_FOUND("ASB0011", "Authentication not found", "471", A_SYSTEM_FAILURE_OCCURRED);
AUTHENTICATION_NOT_FOUND(
"ASB0011", "Authentication not found", "471", A_SYSTEM_FAILURE_OCCURRED
);

private final String code;
private final String description;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@
@Getter
@RequiredArgsConstructor
public enum TechnicalErrorMessage {
AUTHENTICATION_SAVE("AST0009", "Error saving authentication", "439", A_SYSTEM_FAILURE_OCCURRED),
AUTHENTICATION_FIND("AST0010", "Error finding authentication", "440", A_SYSTEM_FAILURE_OCCURRED),
AUTHENTICATION_SAVE(
"AST0009", "Error saving authentication", "439", A_SYSTEM_FAILURE_OCCURRED
),
AUTHENTICATION_FIND(
"AST0010", "Error finding authentication", "440", A_SYSTEM_FAILURE_OCCURRED
),
AUTHENTICATION_DELETE(
"AST0013", "Error deleting authentication", "443", A_SYSTEM_FAILURE_OCCURRED);
"AST0013", "Error deleting authentication", "443", A_SYSTEM_FAILURE_OCCURRED
);

private final String code;
private final String description;
Expand Down
2 changes: 1 addition & 1 deletion examples-ca/channel-operations/domain/usecase/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
dependencies {
compile project(':model')
implementation project(':model')
}
4 changes: 3 additions & 1 deletion examples-ca/channel-operations/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package=co.com.bancolombia
systemProp.version=1.8.2
systemProp.version=3.6.3
reactive=true
lombok=true
org.gradle.parallel=true
language=java
metrics=false
Loading

0 comments on commit 6aa578e

Please sign in to comment.