From c5ab8f6ec860c6241d8ecb9a533db5ac8259917d Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Sat, 31 Aug 2024 07:53:10 +0000 Subject: [PATCH 1/3] feat : apply spring boot best practices --- aws-cloudwatch-project/Dockerfile | 2 +- aws-cloudwatch-project/pom.xml | 6 ++++++ aws-dynamodb-project/Dockerfile | 2 +- aws-dynamodb-project/pom.xml | 6 ++++++ aws-kinesis-project/consumer/Dockerfile | 2 +- aws-kinesis-project/producer/Dockerfile | 2 +- aws-lambda-project/Dockerfile | 2 +- .../src/main/resources/application.properties | 1 + .../com/learning/awslambda/ApplicationIntegrationTest.java | 4 ++-- aws-parameterstore-project/Dockerfile | 2 +- aws-s3-project/Dockerfile | 2 +- aws-secretmanager-project/Dockerfile | 2 +- aws-secretmanager-project/pom.xml | 6 ++++++ aws-ses-project/Dockerfile | 2 +- aws-ses-project/pom.xml | 6 ++++++ aws-sns-project/Dockerfile | 2 +- aws-sns-project/pom.xml | 6 ++++++ aws-sqs-project/Dockerfile | 2 +- aws-sqs-project/pom.xml | 6 ++++++ pom.xml | 3 ++- 20 files changed, 52 insertions(+), 14 deletions(-) diff --git a/aws-cloudwatch-project/Dockerfile b/aws-cloudwatch-project/Dockerfile index 7965975b..0446657c 100644 --- a/aws-cloudwatch-project/Dockerfile +++ b/aws-cloudwatch-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-cloudwatch-project/pom.xml b/aws-cloudwatch-project/pom.xml index e067ccad..d542429e 100644 --- a/aws-cloudwatch-project/pom.xml +++ b/aws-cloudwatch-project/pom.xml @@ -124,6 +124,12 @@ org.testcontainers junit-jupiter test + + + junit + junit + + org.testcontainers diff --git a/aws-dynamodb-project/Dockerfile b/aws-dynamodb-project/Dockerfile index 3ca29b32..aa686276 100644 --- a/aws-dynamodb-project/Dockerfile +++ b/aws-dynamodb-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] \ No newline at end of file +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] \ No newline at end of file diff --git a/aws-dynamodb-project/pom.xml b/aws-dynamodb-project/pom.xml index f9340229..3cb81015 100644 --- a/aws-dynamodb-project/pom.xml +++ b/aws-dynamodb-project/pom.xml @@ -109,6 +109,12 @@ org.testcontainers junit-jupiter test + + + junit + junit + + diff --git a/aws-kinesis-project/consumer/Dockerfile b/aws-kinesis-project/consumer/Dockerfile index 9339f3d3..ff3d68dc 100644 --- a/aws-kinesis-project/consumer/Dockerfile +++ b/aws-kinesis-project/consumer/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-kinesis-project/producer/Dockerfile b/aws-kinesis-project/producer/Dockerfile index d0185d60..6c44aa79 100644 --- a/aws-kinesis-project/producer/Dockerfile +++ b/aws-kinesis-project/producer/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-lambda-project/Dockerfile b/aws-lambda-project/Dockerfile index 6f0b7c8c..87be3897 100644 --- a/aws-lambda-project/Dockerfile +++ b/aws-lambda-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-lambda-project/src/main/resources/application.properties b/aws-lambda-project/src/main/resources/application.properties index 7b6a1122..719bbe3f 100644 --- a/aws-lambda-project/src/main/resources/application.properties +++ b/aws-lambda-project/src/main/resources/application.properties @@ -4,6 +4,7 @@ server.shutdown=graceful spring.main.allow-bean-definition-overriding=true spring.jmx.enabled=false spring.mvc.problemdetails.enabled=true +spring.threads.virtual.enabled=true ################ Actuator ##################### management.endpoints.web.exposure.include=configprops,env,health,info,logfile,loggers,metrics,prometheus,functions diff --git a/aws-lambda-project/src/test/java/com/learning/awslambda/ApplicationIntegrationTest.java b/aws-lambda-project/src/test/java/com/learning/awslambda/ApplicationIntegrationTest.java index bcfd6d03..b5941520 100644 --- a/aws-lambda-project/src/test/java/com/learning/awslambda/ApplicationIntegrationTest.java +++ b/aws-lambda-project/src/test/java/com/learning/awslambda/ApplicationIntegrationTest.java @@ -5,7 +5,7 @@ import io.restassured.RestAssured; import java.io.File; import java.io.IOException; -import java.nio.file.Paths; +import java.nio.file.Path; import java.util.List; import java.util.Map; import java.util.Properties; @@ -168,7 +168,7 @@ private static String buildJar() { defaultInvocationRequest.setMavenHome(new File(System.getenv("MAVEN_HOME"))); } defaultInvocationRequest.setJavaHome(new File(System.getenv("JAVA_HOME"))); - defaultInvocationRequest.setPomFile(Paths.get("pom.xml").toFile()); + defaultInvocationRequest.setPomFile(Path.of("pom.xml").toFile()); defaultInvocationRequest.setGoals(List.of("package")); defaultInvocationRequest.setProperties(properties); var appInvoker = new DefaultInvoker(); diff --git a/aws-parameterstore-project/Dockerfile b/aws-parameterstore-project/Dockerfile index 53f01bb8..429a20be 100644 --- a/aws-parameterstore-project/Dockerfile +++ b/aws-parameterstore-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-s3-project/Dockerfile b/aws-s3-project/Dockerfile index f868e8e7..0557191d 100644 --- a/aws-s3-project/Dockerfile +++ b/aws-s3-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-secretmanager-project/Dockerfile b/aws-secretmanager-project/Dockerfile index 7e116051..09cd796d 100644 --- a/aws-secretmanager-project/Dockerfile +++ b/aws-secretmanager-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-secretmanager-project/pom.xml b/aws-secretmanager-project/pom.xml index e65b5a20..bcdd5cff 100644 --- a/aws-secretmanager-project/pom.xml +++ b/aws-secretmanager-project/pom.xml @@ -113,6 +113,12 @@ org.testcontainers junit-jupiter test + + + junit + junit + + org.testcontainers diff --git a/aws-ses-project/Dockerfile b/aws-ses-project/Dockerfile index 2cc64870..364cdc0e 100644 --- a/aws-ses-project/Dockerfile +++ b/aws-ses-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-ses-project/pom.xml b/aws-ses-project/pom.xml index 0cc47b58..0a3d0463 100644 --- a/aws-ses-project/pom.xml +++ b/aws-ses-project/pom.xml @@ -112,6 +112,12 @@ org.testcontainers junit-jupiter test + + + junit + junit + + diff --git a/aws-sns-project/Dockerfile b/aws-sns-project/Dockerfile index a1643ba5..d2d00000 100644 --- a/aws-sns-project/Dockerfile +++ b/aws-sns-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-sns-project/pom.xml b/aws-sns-project/pom.xml index 086fe03b..c9924f64 100644 --- a/aws-sns-project/pom.xml +++ b/aws-sns-project/pom.xml @@ -96,6 +96,12 @@ org.testcontainers junit-jupiter test + + + junit + junit + + diff --git a/aws-sqs-project/Dockerfile b/aws-sqs-project/Dockerfile index 0ae3281c..40766e97 100644 --- a/aws-sqs-project/Dockerfile +++ b/aws-sqs-project/Dockerfile @@ -11,4 +11,4 @@ COPY --from=builder application/dependencies/ ./ COPY --from=builder application/spring-boot-loader/ ./ COPY --from=builder application/snapshot-dependencies/ ./ COPY --from=builder application/application/ ./ -ENTRYPOINT ["java", "org.springframework.boot.loader.JarLauncher"] +ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] diff --git a/aws-sqs-project/pom.xml b/aws-sqs-project/pom.xml index a3ff4805..3e73cc04 100644 --- a/aws-sqs-project/pom.xml +++ b/aws-sqs-project/pom.xml @@ -130,6 +130,12 @@ org.testcontainers junit-jupiter test + + + junit + junit + + org.testcontainers diff --git a/pom.xml b/pom.xml index 9dd37bd4..81e3c0a1 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,8 @@ aws-projects - + + 21 rajadilipkolli https://sonarcloud.io From 8da3dd8ebd93a7eb4ce3e3fe5f7d1d33da548139 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Sat, 31 Aug 2024 08:16:08 +0000 Subject: [PATCH 2/3] fix : build failure issue --- aws-cloudwatch-project/pom.xml | 6 ------ aws-dynamodb-project/pom.xml | 6 ------ aws-secretmanager-project/pom.xml | 6 ------ aws-ses-project/pom.xml | 6 ------ aws-sns-project/pom.xml | 6 ------ aws-sqs-project/pom.xml | 6 ------ 6 files changed, 36 deletions(-) diff --git a/aws-cloudwatch-project/pom.xml b/aws-cloudwatch-project/pom.xml index d542429e..e067ccad 100644 --- a/aws-cloudwatch-project/pom.xml +++ b/aws-cloudwatch-project/pom.xml @@ -124,12 +124,6 @@ org.testcontainers junit-jupiter test - - - junit - junit - - org.testcontainers diff --git a/aws-dynamodb-project/pom.xml b/aws-dynamodb-project/pom.xml index 3cb81015..f9340229 100644 --- a/aws-dynamodb-project/pom.xml +++ b/aws-dynamodb-project/pom.xml @@ -109,12 +109,6 @@ org.testcontainers junit-jupiter test - - - junit - junit - - diff --git a/aws-secretmanager-project/pom.xml b/aws-secretmanager-project/pom.xml index bcdd5cff..e65b5a20 100644 --- a/aws-secretmanager-project/pom.xml +++ b/aws-secretmanager-project/pom.xml @@ -113,12 +113,6 @@ org.testcontainers junit-jupiter test - - - junit - junit - - org.testcontainers diff --git a/aws-ses-project/pom.xml b/aws-ses-project/pom.xml index 0a3d0463..0cc47b58 100644 --- a/aws-ses-project/pom.xml +++ b/aws-ses-project/pom.xml @@ -112,12 +112,6 @@ org.testcontainers junit-jupiter test - - - junit - junit - - diff --git a/aws-sns-project/pom.xml b/aws-sns-project/pom.xml index c9924f64..086fe03b 100644 --- a/aws-sns-project/pom.xml +++ b/aws-sns-project/pom.xml @@ -96,12 +96,6 @@ org.testcontainers junit-jupiter test - - - junit - junit - - diff --git a/aws-sqs-project/pom.xml b/aws-sqs-project/pom.xml index 3e73cc04..a3ff4805 100644 --- a/aws-sqs-project/pom.xml +++ b/aws-sqs-project/pom.xml @@ -130,12 +130,6 @@ org.testcontainers junit-jupiter test - - - junit - junit - - org.testcontainers From 2547beacc612c4d69759e0212365d648f848c2c8 Mon Sep 17 00:00:00 2001 From: Raja Kolli Date: Sat, 31 Aug 2024 08:26:54 +0000 Subject: [PATCH 3/3] fix : build issue --- .../src/main/resources/application.properties | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/aws-lambda-project/src/main/resources/application.properties b/aws-lambda-project/src/main/resources/application.properties index 719bbe3f..f91b881e 100644 --- a/aws-lambda-project/src/main/resources/application.properties +++ b/aws-lambda-project/src/main/resources/application.properties @@ -4,11 +4,25 @@ server.shutdown=graceful spring.main.allow-bean-definition-overriding=true spring.jmx.enabled=false spring.mvc.problemdetails.enabled=true -spring.threads.virtual.enabled=true +#spring.threads.virtual.enabled=true ################ Actuator ##################### management.endpoints.web.exposure.include=configprops,env,health,info,logfile,loggers,metrics,prometheus,functions management.endpoint.health.show-details=always ################ Database ##################### +spring.jpa.show-sql=false +spring.jpa.open-in-view=false spring.datasource.hikari.auto-commit=false +spring.jpa.hibernate.ddl-auto=none +#spring.jpa.properties.hibernate.format_sql=true +spring.jpa.properties.hibernate.jdbc.time_zone=UTC +spring.jpa.properties.hibernate.generate_statistics=false +spring.jpa.properties.hibernate.jdbc.batch_size=25 +spring.jpa.properties.hibernate.order_inserts=true +spring.jpa.properties.hibernate.order_updates=true +spring.jpa.properties.hibernate.query.fail_on_pagination_over_collection_fetch=true +spring.jpa.properties.hibernate.query.in_clause_parameter_padding=true +spring.jpa.properties.hibernate.query.plan_cache_max_size=4096 +spring.jpa.properties.hibernate.connection.provider_disables_autocommit=true +spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true