This is an automated email from the ASF dual-hosted git repository.
victorromero pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
The following commit(s) were added to refs/heads/develop by this push:
new 2d03ebb179 FINERACT-2181: Upgrade Spring-boot version (#4477)
2d03ebb179 is described below
commit 2d03ebb17986e0e76c9e9a0dab387cf62f388a15
Author: Adam Saghy <[email protected]>
AuthorDate: Wed Mar 19 06:57:56 2025 +0100
FINERACT-2181: Upgrade Spring-boot version (#4477)
---
build.gradle | 2 +-
.../groovy/org.apache.fineract.dependencies.gradle | 2 +-
.../core/jersey/JerseyJacksonConverterConfig.java | 18 ++++++++--------
.../migration/ExtendedSpringLiquibaseBuilder.java | 24 ++++++++++++----------
.../jobs/ScheduledJobRunnerConfig.java | 21 +++++++------------
5 files changed, 30 insertions(+), 37 deletions(-)
diff --git a/build.gradle b/build.gradle
index de5733454a..278e4df1a1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -97,7 +97,7 @@ plugins {
id 'com.github.hierynomus.license' version '0.16.1' apply false
id 'com.github.jk1.dependency-license-report' version '2.9' apply false
id 'org.zeroturnaround.gradle.jrebel' version '1.2.0' apply false
- id 'org.springframework.boot' version '3.3.5' apply false
+ id 'org.springframework.boot' version '3.4.3' apply false
id 'net.ltgt.errorprone' version '4.1.0' apply false
id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.2.23' apply false
id 'com.gorylenko.gradle-git-properties' version '2.4.2' apply false
diff --git a/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle
b/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle
index baf7e3dbc9..1c9cadf0ed 100644
--- a/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle
+++ b/buildSrc/src/main/groovy/org.apache.fineract.dependencies.gradle
@@ -26,7 +26,7 @@ dependencyManagement {
mavenBom 'org.slf4j:slf4j-bom:2.0.17'
mavenBom 'io.micrometer:micrometer-bom:1.13.6'
mavenBom 'org.springframework:spring-framework-bom:6.1.14'
- mavenBom 'org.springframework.boot:spring-boot-dependencies:3.3.5'
+ mavenBom 'org.springframework.boot:spring-boot-dependencies:3.4.3'
mavenBom 'io.awspring.cloud:spring-cloud-aws-dependencies:3.2.1'
mavenBom 'io.opentelemetry:opentelemetry-bom:1.44.1'
mavenBom 'org.jetbrains.kotlin:kotlin-bom:2.0.21'
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/jersey/JerseyJacksonConverterConfig.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/jersey/JerseyJacksonConverterConfig.java
index fe86a7004c..ce5cfbdc08 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/jersey/JerseyJacksonConverterConfig.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/jersey/JerseyJacksonConverterConfig.java
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.module.paramnames.ParameterNamesModule;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.List;
import org.apache.fineract.infrastructure.core.jersey.converter.JsonConverter;
@@ -31,23 +31,21 @@ import
org.apache.fineract.infrastructure.core.jersey.serializer.JacksonSerializ
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
-import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration
public class JerseyJacksonConverterConfig {
@Bean
- public MappingJackson2HttpMessageConverter
jacksonHttpConverter(List<JsonSerializer<?>> serializers,
- List<JsonDeserializer<?>> deserializers, List<JsonConverter<?>>
jsonConverters) {
+ public ObjectMapper objectMapper(List<JsonSerializer<?>> serializers,
List<JsonDeserializer<?>> deserializers,
+ List<JsonConverter<?>> jsonConverters) {
+ // Merge JsonConverters with serializers and deserializers
List<JsonSerializer<?>> mergedSerializers = new
ArrayList<>(serializers);
mergedSerializers.addAll(jsonConverters.stream().map(JacksonSerializerAdapter::new).toList());
-
List<JsonDeserializer<?>> mergedDeserializers = new
ArrayList<>(deserializers);
mergedDeserializers.addAll(jsonConverters.stream().map(JacksonDeserializerAdapter::new).toList());
-
- return new MappingJackson2HttpMessageConverter(new
Jackson2ObjectMapperBuilder().indentOutput(true)
- .serializers(mergedSerializers.toArray(new JsonSerializer[0]))
- .deserializers(mergedDeserializers.toArray(new
JsonDeserializer[0])).serializationInclusion(JsonInclude.Include.NON_NULL)
-
.featuresToEnable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS).modulesToInstall(new
ParameterNamesModule()).build());
+ return new
Jackson2ObjectMapperBuilder().serializers(mergedSerializers.toArray(new
JsonSerializer[0]))
+
.serializationInclusion(JsonInclude.Include.NON_NULL).deserializers(mergedDeserializers.toArray(new
JsonDeserializer[0]))
+
.featuresToDisable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
+
.featuresToEnable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS).build();
}
}
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/ExtendedSpringLiquibaseBuilder.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/ExtendedSpringLiquibaseBuilder.java
index cf49695678..3c9486275c 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/ExtendedSpringLiquibaseBuilder.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/service/migration/ExtendedSpringLiquibaseBuilder.java
@@ -22,19 +22,19 @@ import static
org.apache.commons.lang3.StringUtils.isNotBlank;
import com.google.common.base.Joiner;
import java.io.File;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
import javax.sql.DataSource;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.core.io.ResourceLoader;
public class ExtendedSpringLiquibaseBuilder {
- private final Set<String> contexts = new HashSet<>();
+ private final List<String> contexts = new ArrayList<>();
private final Map<String, String> changeLogParameters = new HashMap<>();
private final boolean clearCheckSums;
private final String liquibaseSchema;
@@ -42,14 +42,14 @@ public class ExtendedSpringLiquibaseBuilder {
private final String databaseChangeLogTable;
private final String databaseChangeLogLockTable;
private final boolean shouldRun;
- private final String labelFilter;
+ private final List<String> labelFilter = new ArrayList<>();
private final File rollbackFile;
private final boolean testRollbackOnUpdate;
private final String tag;
- private String changeLog;
+ private final String changeLog;
private ResourceLoader resourceLoader;
- private String defaultSchema;
- private boolean dropFirst;
+ private final String defaultSchema;
+ private final boolean dropFirst;
private DataSource dataSource;
public ExtendedSpringLiquibaseBuilder(LiquibaseProperties
liquibaseProperties) {
@@ -59,8 +59,8 @@ public class ExtendedSpringLiquibaseBuilder {
this.changeLogParameters.putAll(liquibaseProperties.getParameters());
}
this.changeLog = liquibaseProperties.getChangeLog();
- if (isNotBlank(liquibaseProperties.getContexts())) {
- this.contexts.add(liquibaseProperties.getContexts());
+ if (liquibaseProperties.getContexts() != null) {
+ this.contexts.addAll(liquibaseProperties.getContexts());
}
this.clearCheckSums = liquibaseProperties.isClearChecksums();
this.liquibaseSchema = liquibaseProperties.getLiquibaseSchema();
@@ -68,7 +68,9 @@ public class ExtendedSpringLiquibaseBuilder {
this.databaseChangeLogTable =
liquibaseProperties.getDatabaseChangeLogTable();
this.databaseChangeLogLockTable =
liquibaseProperties.getDatabaseChangeLogLockTable();
this.shouldRun = liquibaseProperties.isEnabled();
- this.labelFilter = liquibaseProperties.getLabelFilter();
+ if (liquibaseProperties.getContexts() != null) {
+ this.contexts.addAll(liquibaseProperties.getLabelFilter());
+ }
this.rollbackFile = liquibaseProperties.getRollbackFile();
this.testRollbackOnUpdate =
liquibaseProperties.isTestRollbackOnUpdate();
this.tag = liquibaseProperties.getTag();
@@ -116,7 +118,7 @@ public class ExtendedSpringLiquibaseBuilder {
result.setDatabaseChangeLogTable(databaseChangeLogTable);
result.setDatabaseChangeLogLockTable(databaseChangeLogLockTable);
result.setShouldRun(shouldRun);
- result.setLabelFilter(labelFilter);
+ result.setLabelFilter(Joiner.on(",").join(labelFilter));
result.setRollbackFile(rollbackFile);
result.setTestRollbackOnUpdate(testRollbackOnUpdate);
result.setTag(tag);
diff --git
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/ScheduledJobRunnerConfig.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/ScheduledJobRunnerConfig.java
index ca7a0b552d..2276cfad2d 100644
---
a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/ScheduledJobRunnerConfig.java
+++
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/jobs/ScheduledJobRunnerConfig.java
@@ -23,9 +23,7 @@ import
org.apache.fineract.infrastructure.core.persistence.ExtendedJpaTransactio
import
org.apache.fineract.infrastructure.core.persistence.TransactionLifecycleCallback;
import
org.apache.fineract.infrastructure.core.service.database.RoutingDataSource;
import
org.apache.fineract.infrastructure.jobs.config.FineractDataFieldMaxValueIncrementerFactory;
-import org.springframework.batch.core.configuration.JobRegistry;
import
org.springframework.batch.core.configuration.annotation.EnableBatchProcessing;
-import
org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
@@ -66,24 +64,26 @@ public class ScheduledJobRunnerConfig {
}
@Bean
- public JobRepository jobRepository(RoutingDataSource routingDataSource,
PlatformTransactionManager transactionManager)
+ public JobRepository jobRepository(RoutingDataSource routingDataSource,
PlatformTransactionManager transactionManager,
+ Jackson2ExecutionContextStringSerializer
executionContextSerializer, DataFieldMaxValueIncrementerFactory
incrementerFactory)
throws Exception {
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
factory.setDataSource(routingDataSource);
factory.setTransactionManager(transactionManager);
factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED");
- factory.setSerializer(executionContextSerializer());
- factory.setIncrementerFactory(incrementerFactory(routingDataSource));
+ factory.setSerializer(executionContextSerializer);
+ factory.setIncrementerFactory(incrementerFactory);
factory.afterPropertiesSet();
return factory.getObject();
}
@Bean
- public JobExplorer jobExplorer(RoutingDataSource routingDataSource,
PlatformTransactionManager transactionManager) throws Exception {
+ public JobExplorer jobExplorer(RoutingDataSource routingDataSource,
PlatformTransactionManager transactionManager,
+ Jackson2ExecutionContextStringSerializer
executionContextSerializer) throws Exception {
JobExplorerFactoryBean jobExplorerFactoryBean = new
JobExplorerFactoryBean();
jobExplorerFactoryBean.setDataSource(routingDataSource);
jobExplorerFactoryBean.setTransactionManager(transactionManager);
- jobExplorerFactoryBean.setSerializer(executionContextSerializer());
+ jobExplorerFactoryBean.setSerializer(executionContextSerializer);
jobExplorerFactoryBean.afterPropertiesSet();
return jobExplorerFactoryBean.getObject();
}
@@ -95,11 +95,4 @@ public class ScheduledJobRunnerConfig {
launcher.afterPropertiesSet();
return launcher;
}
-
- @Bean
- public JobRegistryBeanPostProcessor
jobRegistryBeanPostProcessor(JobRegistry jobRegistry) {
- final JobRegistryBeanPostProcessor postProcessor = new
JobRegistryBeanPostProcessor();
- postProcessor.setJobRegistry(jobRegistry);
- return postProcessor;
- }
}