From 2a9c31fbf6dc97b454183990830dd2a0a03ddb7b Mon Sep 17 00:00:00 2001 From: Eric Opoku Date: Thu, 17 Oct 2024 22:42:21 -0400 Subject: [PATCH] remove deprecated class and update dependencies --- build.gradle | 23 ++++++++++--------- .../persistent/domain/base/BaseEntity.java | 20 ++++------------ .../config/core/DevConfig.java | 5 ++-- .../config/core/DockerConfig.java | 5 ++-- .../config/core/ProdConfig.java | 3 +-- src/main/resources/application.properties | 2 +- 6 files changed, 23 insertions(+), 35 deletions(-) diff --git a/build.gradle b/build.gradle index c463f7f..cb43715 100644 --- a/build.gradle +++ b/build.gradle @@ -1,6 +1,6 @@ plugins { id 'org.springframework.boot' version '3.3.4' - id 'io.spring.dependency-management' version '1.1.5' + id 'io.spring.dependency-management' version '1.1.6' id 'org.owasp.dependencycheck' version '10.0.0' id 'com.diffplug.spotless' version '6.25.0' id 'eclipse' @@ -36,10 +36,10 @@ repositories { } ext { - set('jjwtVersion', '0.12.5') + set('jjwtVersion', '0.12.6') set('springDocVersion', '2.6.0') set('javadocScribeVersion', '0.15.0') - set('mapstructVersion', '1.5.5.Final') + set('mapstructVersion', '1.6.2') } dependencies { @@ -67,8 +67,8 @@ dependencies { implementation "io.jsonwebtoken:jjwt-api:${jjwtVersion}" runtimeOnly "io.jsonwebtoken:jjwt-impl:${jjwtVersion}" runtimeOnly "io.jsonwebtoken:jjwt-jackson:${jjwtVersion}" - implementation 'commons-io:commons-io:2.16.1' - implementation 'net.datafaker:datafaker:2.3.1' + implementation 'commons-io:commons-io:2.17.0' + implementation 'net.datafaker:datafaker:2.4.0' implementation 'com.google.code.gson:gson:2.11.0' implementation 'commons-validator:commons-validator:1.9.0' implementation 'com.github.darrachequesne:spring-data-jpa-datatables:6.0.4' @@ -84,7 +84,7 @@ dependencies { runtimeOnly 'org.postgresql:postgresql' implementation 'org.liquibase:liquibase-core' implementation 'org.hibernate.orm:hibernate-envers' - implementation 'com.amazonaws:aws-java-sdk-s3:1.12.686' + implementation 'com.amazonaws:aws-java-sdk-s3:1.12.765' implementation files('libs/hypersistence-optimizer-2.6.3-jakarta.jar') // MapStruct for Object Mapping @@ -95,9 +95,9 @@ dependencies { implementation 'org.webjars:jquery:3.7.1' implementation 'org.webjars:bootstrap:5.3.3' implementation 'org.webjars:popper.js:2.11.7' - implementation 'org.webjars:jquery-ui:1.13.2' + implementation 'org.webjars:jquery-ui:1.14.0' implementation 'org.webjars:datatables:1.13.5' - implementation 'org.webjars:font-awesome:6.5.1' + implementation 'org.webjars:font-awesome:6.5.2' implementation 'org.webjars:webjars-locator:0.52' } @@ -110,11 +110,11 @@ testing { dependencies { compileOnly 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' - implementation 'org.mockito:mockito-inline:5.2.0' + implementation 'org.mockito:mockito-core:5.14.2' implementation 'io.findify:s3mock_2.13:0.2.6' - implementation 'com.icegreen:greenmail-junit5:2.0.1' + implementation 'com.icegreen:greenmail-junit5:2.1.0' implementation 'com.jparams:to-string-verifier:1.4.8' - implementation 'nl.jqno.equalsverifier:equalsverifier:3.17' + implementation 'nl.jqno.equalsverifier:equalsverifier:3.17.1' implementation 'org.springframework.security:spring-security-test' implementation 'org.springframework.boot:spring-boot-starter-test' } @@ -128,6 +128,7 @@ testing { implementation sourceSets.test.output implementation 'org.springframework.boot:spring-boot-testcontainers' + implementation 'com.amazonaws:aws-java-sdk-core:1.12.765' implementation 'org.testcontainers:junit-jupiter' implementation 'org.testcontainers:postgresql' } diff --git a/src/main/java/com/developersboard/backend/persistent/domain/base/BaseEntity.java b/src/main/java/com/developersboard/backend/persistent/domain/base/BaseEntity.java index 5e9df76..1ff43c8 100644 --- a/src/main/java/com/developersboard/backend/persistent/domain/base/BaseEntity.java +++ b/src/main/java/com/developersboard/backend/persistent/domain/base/BaseEntity.java @@ -7,6 +7,7 @@ import jakarta.persistence.Id; import jakarta.persistence.MappedSuperclass; import jakarta.persistence.PrePersist; +import jakarta.persistence.SequenceGenerator; import jakarta.persistence.Version; import jakarta.validation.constraints.NotBlank; import java.io.Serializable; @@ -16,8 +17,6 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; -import org.hibernate.annotations.GenericGenerator; -import org.hibernate.annotations.Parameter; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; @@ -39,22 +38,13 @@ public class BaseEntity { private static final String SEQUENCE_NAME = "SpringBootStarterSequence"; - private static final String SEQUENCE_INITIAL_VALUE = "1"; private static final String SEQUENCE_GENERATOR_NAME = "SpringBootStarterSequenceGenerator"; - /** - * Sequence Style Generator to auto generate ID based on the choices in the parameters. - * - * @see AssignedSequenceStyleGenerator - */ - @GenericGenerator( + /** Sequence Generator to auto generate IDs. */ + @SequenceGenerator( name = SEQUENCE_GENERATOR_NAME, - type = AssignedSequenceStyleGenerator.class, - parameters = { - @Parameter(name = "sequence_name", value = SEQUENCE_NAME), - @Parameter(name = "initial_value", value = SEQUENCE_INITIAL_VALUE), - @Parameter(name = "increment_size", value = SEQUENCE_INITIAL_VALUE) - }) + sequenceName = SEQUENCE_NAME, + allocationSize = 1) @Id @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = SEQUENCE_GENERATOR_NAME) private T id; diff --git a/src/main/java/com/developersboard/config/core/DevConfig.java b/src/main/java/com/developersboard/config/core/DevConfig.java index 5c686ad..4e64c99 100644 --- a/src/main/java/com/developersboard/config/core/DevConfig.java +++ b/src/main/java/com/developersboard/config/core/DevConfig.java @@ -2,7 +2,6 @@ import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.developersboard.config.properties.AwsProperties; @@ -33,11 +32,11 @@ public class DevConfig { */ @Bean public AmazonS3 amazonS3(AwsProperties props) { - // Create the credentials provider + // Create the credential provider var credentials = new BasicAWSCredentials(props.getAccessKeyId(), props.getSecretAccessKey()); return AmazonS3ClientBuilder.standard() - .withRegion(Regions.fromName(props.getRegion())) + .withRegion(props.getRegion()) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); } diff --git a/src/main/java/com/developersboard/config/core/DockerConfig.java b/src/main/java/com/developersboard/config/core/DockerConfig.java index 5a7fb90..1918e2d 100644 --- a/src/main/java/com/developersboard/config/core/DockerConfig.java +++ b/src/main/java/com/developersboard/config/core/DockerConfig.java @@ -2,7 +2,6 @@ import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.developersboard.backend.service.mail.EmailService; @@ -35,11 +34,11 @@ public class DockerConfig { */ @Bean public AmazonS3 amazonS3(AwsProperties props) { - // Create the credentials provider + // Create the credential provider var credentials = new BasicAWSCredentials(props.getAccessKeyId(), props.getSecretAccessKey()); return AmazonS3ClientBuilder.standard() - .withRegion(Regions.fromName(props.getRegion())) + .withRegion(props.getRegion()) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); } diff --git a/src/main/java/com/developersboard/config/core/ProdConfig.java b/src/main/java/com/developersboard/config/core/ProdConfig.java index 50bc06d..dd1a8cb 100644 --- a/src/main/java/com/developersboard/config/core/ProdConfig.java +++ b/src/main/java/com/developersboard/config/core/ProdConfig.java @@ -2,7 +2,6 @@ import com.amazonaws.auth.AWSStaticCredentialsProvider; import com.amazonaws.auth.BasicAWSCredentials; -import com.amazonaws.regions.Regions; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.developersboard.config.properties.AwsProperties; @@ -35,7 +34,7 @@ public AmazonS3 amazonS3(AwsProperties props) { var credentials = new BasicAWSCredentials(props.getAccessKeyId(), props.getSecretAccessKey()); return AmazonS3ClientBuilder.standard() - .withRegion(Regions.fromName(props.getRegion())) + .withRegion(props.getRegion()) .withCredentials(new AWSStaticCredentialsProvider(credentials)) .build(); } diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 3bcfd30..6a73b70 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -46,7 +46,7 @@ spring.jpa.properties.hibernate.query.fail_on_pagination_over_collection_fetch=t spring.jpa.properties.org.hibernate.envers.audit_strategy=org.hibernate.envers.strategy.internal.ValidityAuditStrategy spring.jpa.properties.org.hibernate.envers.audit_table_suffix=_AUDIT_LOG server.error.include-stacktrace=ON_PARAM -server.max-http-header-size=40KB +server.max-http-request-header-size=40KB # =============================== # = JACKSON # ===============================