FINERACT-2181: Upgrade Spring-boot version (#4477)

This commit is contained in:
Adam Saghy
2025-03-18 23:57:56 -06:00
committed by GitHub
parent 7dd2a8ba1e
commit 2d03ebb179
5 changed files with 30 additions and 37 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ plugins {
id 'com.github.hierynomus.license' version '0.16.1' apply false id 'com.github.hierynomus.license' version '0.16.1' apply false
id 'com.github.jk1.dependency-license-report' version '2.9' 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.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 'net.ltgt.errorprone' version '4.1.0' apply false
id 'io.swagger.core.v3.swagger-gradle-plugin' version '2.2.23' 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 id 'com.gorylenko.gradle-git-properties' version '2.4.2' apply false
@@ -26,7 +26,7 @@ dependencyManagement {
mavenBom 'org.slf4j:slf4j-bom:2.0.17' mavenBom 'org.slf4j:slf4j-bom:2.0.17'
mavenBom 'io.micrometer:micrometer-bom:1.13.6' mavenBom 'io.micrometer:micrometer-bom:1.13.6'
mavenBom 'org.springframework:spring-framework-bom:6.1.14' 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.awspring.cloud:spring-cloud-aws-dependencies:3.2.1'
mavenBom 'io.opentelemetry:opentelemetry-bom:1.44.1' mavenBom 'io.opentelemetry:opentelemetry-bom:1.44.1'
mavenBom 'org.jetbrains.kotlin:kotlin-bom:2.0.21' mavenBom 'org.jetbrains.kotlin:kotlin-bom:2.0.21'
@@ -22,7 +22,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.JsonDeserializer; import com.fasterxml.jackson.databind.JsonDeserializer;
import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.MapperFeature; 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.ArrayList;
import java.util.List; import java.util.List;
import org.apache.fineract.infrastructure.core.jersey.converter.JsonConverter; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
@Configuration @Configuration
public class JerseyJacksonConverterConfig { public class JerseyJacksonConverterConfig {
@Bean @Bean
public MappingJackson2HttpMessageConverter jacksonHttpConverter(List<JsonSerializer<?>> serializers, public ObjectMapper objectMapper(List<JsonSerializer<?>> serializers, List<JsonDeserializer<?>> deserializers,
List<JsonDeserializer<?>> deserializers, List<JsonConverter<?>> jsonConverters) { List<JsonConverter<?>> jsonConverters) {
// Merge JsonConverters with serializers and deserializers
List<JsonSerializer<?>> mergedSerializers = new ArrayList<>(serializers); List<JsonSerializer<?>> mergedSerializers = new ArrayList<>(serializers);
mergedSerializers.addAll(jsonConverters.stream().map(JacksonSerializerAdapter::new).toList()); mergedSerializers.addAll(jsonConverters.stream().map(JacksonSerializerAdapter::new).toList());
List<JsonDeserializer<?>> mergedDeserializers = new ArrayList<>(deserializers); List<JsonDeserializer<?>> mergedDeserializers = new ArrayList<>(deserializers);
mergedDeserializers.addAll(jsonConverters.stream().map(JacksonDeserializerAdapter::new).toList()); mergedDeserializers.addAll(jsonConverters.stream().map(JacksonDeserializerAdapter::new).toList());
return new Jackson2ObjectMapperBuilder().serializers(mergedSerializers.toArray(new JsonSerializer[0]))
return new MappingJackson2HttpMessageConverter(new Jackson2ObjectMapperBuilder().indentOutput(true) .serializationInclusion(JsonInclude.Include.NON_NULL).deserializers(mergedDeserializers.toArray(new JsonDeserializer[0]))
.serializers(mergedSerializers.toArray(new JsonSerializer[0])) .featuresToDisable(com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
.deserializers(mergedDeserializers.toArray(new JsonDeserializer[0])).serializationInclusion(JsonInclude.Include.NON_NULL) .featuresToEnable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS).build();
.featuresToEnable(MapperFeature.ACCEPT_CASE_INSENSITIVE_ENUMS).modulesToInstall(new ParameterNamesModule()).build());
} }
} }
@@ -22,19 +22,19 @@ import static org.apache.commons.lang3.StringUtils.isNotBlank;
import com.google.common.base.Joiner; import com.google.common.base.Joiner;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import javax.sql.DataSource; import javax.sql.DataSource;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties; import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.core.io.ResourceLoader; import org.springframework.core.io.ResourceLoader;
public class ExtendedSpringLiquibaseBuilder { 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 Map<String, String> changeLogParameters = new HashMap<>();
private final boolean clearCheckSums; private final boolean clearCheckSums;
private final String liquibaseSchema; private final String liquibaseSchema;
@@ -42,14 +42,14 @@ public class ExtendedSpringLiquibaseBuilder {
private final String databaseChangeLogTable; private final String databaseChangeLogTable;
private final String databaseChangeLogLockTable; private final String databaseChangeLogLockTable;
private final boolean shouldRun; private final boolean shouldRun;
private final String labelFilter; private final List<String> labelFilter = new ArrayList<>();
private final File rollbackFile; private final File rollbackFile;
private final boolean testRollbackOnUpdate; private final boolean testRollbackOnUpdate;
private final String tag; private final String tag;
private String changeLog; private final String changeLog;
private ResourceLoader resourceLoader; private ResourceLoader resourceLoader;
private String defaultSchema; private final String defaultSchema;
private boolean dropFirst; private final boolean dropFirst;
private DataSource dataSource; private DataSource dataSource;
public ExtendedSpringLiquibaseBuilder(LiquibaseProperties liquibaseProperties) { public ExtendedSpringLiquibaseBuilder(LiquibaseProperties liquibaseProperties) {
@@ -59,8 +59,8 @@ public class ExtendedSpringLiquibaseBuilder {
this.changeLogParameters.putAll(liquibaseProperties.getParameters()); this.changeLogParameters.putAll(liquibaseProperties.getParameters());
} }
this.changeLog = liquibaseProperties.getChangeLog(); this.changeLog = liquibaseProperties.getChangeLog();
if (isNotBlank(liquibaseProperties.getContexts())) { if (liquibaseProperties.getContexts() != null) {
this.contexts.add(liquibaseProperties.getContexts()); this.contexts.addAll(liquibaseProperties.getContexts());
} }
this.clearCheckSums = liquibaseProperties.isClearChecksums(); this.clearCheckSums = liquibaseProperties.isClearChecksums();
this.liquibaseSchema = liquibaseProperties.getLiquibaseSchema(); this.liquibaseSchema = liquibaseProperties.getLiquibaseSchema();
@@ -68,7 +68,9 @@ public class ExtendedSpringLiquibaseBuilder {
this.databaseChangeLogTable = liquibaseProperties.getDatabaseChangeLogTable(); this.databaseChangeLogTable = liquibaseProperties.getDatabaseChangeLogTable();
this.databaseChangeLogLockTable = liquibaseProperties.getDatabaseChangeLogLockTable(); this.databaseChangeLogLockTable = liquibaseProperties.getDatabaseChangeLogLockTable();
this.shouldRun = liquibaseProperties.isEnabled(); this.shouldRun = liquibaseProperties.isEnabled();
this.labelFilter = liquibaseProperties.getLabelFilter(); if (liquibaseProperties.getContexts() != null) {
this.contexts.addAll(liquibaseProperties.getLabelFilter());
}
this.rollbackFile = liquibaseProperties.getRollbackFile(); this.rollbackFile = liquibaseProperties.getRollbackFile();
this.testRollbackOnUpdate = liquibaseProperties.isTestRollbackOnUpdate(); this.testRollbackOnUpdate = liquibaseProperties.isTestRollbackOnUpdate();
this.tag = liquibaseProperties.getTag(); this.tag = liquibaseProperties.getTag();
@@ -116,7 +118,7 @@ public class ExtendedSpringLiquibaseBuilder {
result.setDatabaseChangeLogTable(databaseChangeLogTable); result.setDatabaseChangeLogTable(databaseChangeLogTable);
result.setDatabaseChangeLogLockTable(databaseChangeLogLockTable); result.setDatabaseChangeLogLockTable(databaseChangeLogLockTable);
result.setShouldRun(shouldRun); result.setShouldRun(shouldRun);
result.setLabelFilter(labelFilter); result.setLabelFilter(Joiner.on(",").join(labelFilter));
result.setRollbackFile(rollbackFile); result.setRollbackFile(rollbackFile);
result.setTestRollbackOnUpdate(testRollbackOnUpdate); result.setTestRollbackOnUpdate(testRollbackOnUpdate);
result.setTag(tag); result.setTag(tag);
@@ -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.persistence.TransactionLifecycleCallback;
import org.apache.fineract.infrastructure.core.service.database.RoutingDataSource; import org.apache.fineract.infrastructure.core.service.database.RoutingDataSource;
import org.apache.fineract.infrastructure.jobs.config.FineractDataFieldMaxValueIncrementerFactory; 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.annotation.EnableBatchProcessing;
import org.springframework.batch.core.configuration.support.JobRegistryBeanPostProcessor;
import org.springframework.batch.core.explore.JobExplorer; import org.springframework.batch.core.explore.JobExplorer;
import org.springframework.batch.core.explore.support.JobExplorerFactoryBean; import org.springframework.batch.core.explore.support.JobExplorerFactoryBean;
import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher; import org.springframework.batch.core.launch.support.TaskExecutorJobLauncher;
@@ -66,24 +64,26 @@ public class ScheduledJobRunnerConfig {
} }
@Bean @Bean
public JobRepository jobRepository(RoutingDataSource routingDataSource, PlatformTransactionManager transactionManager) public JobRepository jobRepository(RoutingDataSource routingDataSource, PlatformTransactionManager transactionManager,
Jackson2ExecutionContextStringSerializer executionContextSerializer, DataFieldMaxValueIncrementerFactory incrementerFactory)
throws Exception { throws Exception {
JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean(); JobRepositoryFactoryBean factory = new JobRepositoryFactoryBean();
factory.setDataSource(routingDataSource); factory.setDataSource(routingDataSource);
factory.setTransactionManager(transactionManager); factory.setTransactionManager(transactionManager);
factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED"); factory.setIsolationLevelForCreate("ISOLATION_READ_COMMITTED");
factory.setSerializer(executionContextSerializer()); factory.setSerializer(executionContextSerializer);
factory.setIncrementerFactory(incrementerFactory(routingDataSource)); factory.setIncrementerFactory(incrementerFactory);
factory.afterPropertiesSet(); factory.afterPropertiesSet();
return factory.getObject(); return factory.getObject();
} }
@Bean @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 jobExplorerFactoryBean = new JobExplorerFactoryBean();
jobExplorerFactoryBean.setDataSource(routingDataSource); jobExplorerFactoryBean.setDataSource(routingDataSource);
jobExplorerFactoryBean.setTransactionManager(transactionManager); jobExplorerFactoryBean.setTransactionManager(transactionManager);
jobExplorerFactoryBean.setSerializer(executionContextSerializer()); jobExplorerFactoryBean.setSerializer(executionContextSerializer);
jobExplorerFactoryBean.afterPropertiesSet(); jobExplorerFactoryBean.afterPropertiesSet();
return jobExplorerFactoryBean.getObject(); return jobExplorerFactoryBean.getObject();
} }
@@ -95,11 +95,4 @@ public class ScheduledJobRunnerConfig {
launcher.afterPropertiesSet(); launcher.afterPropertiesSet();
return launcher; return launcher;
} }
@Bean
public JobRegistryBeanPostProcessor jobRegistryBeanPostProcessor(JobRegistry jobRegistry) {
final JobRegistryBeanPostProcessor postProcessor = new JobRegistryBeanPostProcessor();
postProcessor.setJobRegistry(jobRegistry);
return postProcessor;
}
} }