Bump to Spring Boot 4.0.7 (#3124)

Signed-off-by: Avgustin Marinov <Avgustin.Marinov@bosch.com>
This commit is contained in:
Avgustin Marinov
2026-06-12 11:27:11 +03:00
committed by GitHub
parent 9cb8a7cf00
commit 24714b01fc
7 changed files with 73 additions and 15 deletions

View File

@@ -25,12 +25,12 @@ import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitAdmin;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.rabbit.junit.RabbitAvailable;
import org.springframework.amqp.support.converter.JacksonJsonMessageConverter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import tools.jackson.databind.json.JsonMapper;
@Slf4j
@RabbitAvailable
@@ -88,7 +88,7 @@ public abstract class AbstractAmqpIntegrationTest extends AbstractIntegrationTes
private RabbitTemplate createDmfClient() {
final RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setMessageConverter(new JacksonJsonMessageConverter());
template.setMessageConverter(AmqpTestConfiguration.messageConverter(new JsonMapper()));
template.setReceiveTimeout(TimeUnit.SECONDS.toMillis(3));
template.setReplyTimeout(TimeUnit.SECONDS.toMillis(3));
template.setExchange(getExchange());

View File

@@ -14,6 +14,9 @@ import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.Nullable;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.amqp.support.converter.JacksonJsonMessageConverter;
@@ -24,6 +27,7 @@ import org.springframework.core.task.TaskExecutor;
import org.springframework.scheduling.concurrent.ConcurrentTaskExecutor;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.security.concurrent.DelegatingSecurityContextExecutorService;
import tools.jackson.databind.json.JsonMapper;
@Configuration
public class AmqpTestConfiguration {
@@ -32,7 +36,7 @@ public class AmqpTestConfiguration {
@Primary
public RabbitTemplate rabbitTemplateForTest(final ConnectionFactory connectionFactory) {
final RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
rabbitTemplate.setMessageConverter(new JacksonJsonMessageConverter());
rabbitTemplate.setMessageConverter(messageConverter(new JsonMapper()));
rabbitTemplate.setReplyTimeout(TimeUnit.SECONDS.toMillis(3));
rabbitTemplate.setReceiveTimeout(TimeUnit.SECONDS.toMillis(3));
return rabbitTemplate;
@@ -67,4 +71,19 @@ public class AmqpTestConfiguration {
RabbitMqSetupService rabbitMqSetupService() {
return new RabbitMqSetupService();
}
// note - it MUST be the same as DmfApiConfiguration#messageConverter for the test to work properly (to test the real AMQP)
public static @NonNull JacksonJsonMessageConverter messageConverter(final JsonMapper jsonMapper) {
return new JacksonJsonMessageConverter(jsonMapper, "org.eclipse.hawkbit.dmf.json.model") {
@Override
public @NonNull Object fromMessage(@NonNull final Message message, final @Nullable Object conversionHint) {
if (message.getBody().length == 0) {
return message.getBody();
} else {
return super.fromMessage(message, conversionHint);
}
}
};
}
}