Browse Source

Update rabbitmq docker image version and support EnableRabbit for AMPQ 1.0

Signed-off-by: Eddú Meléndez <eddu.melendez@gmail.com>
Eddú Meléndez 1 month ago
parent
commit
3a9cd50118
No known key found for this signature in database
  1. 2
      module/spring-boot-amqp/src/main/java/org/springframework/boot/amqp/autoconfigure/RabbitAmqpAutoConfiguration.java
  2. 41
      module/spring-boot-amqp/src/main/java/org/springframework/boot/amqp/autoconfigure/RabbitAnnotationDrivenConfiguration.java
  3. 3
      smoke-test/spring-boot-smoke-test-amqp/src/dockerTest/java/smoketest/amqp/SampleRabbitAmqpSimpleApplicationTests.java
  4. 2
      smoke-test/spring-boot-smoke-test-amqp/src/main/java/smoketest/amqp/SampleRabbitAmqpSimpleApplication.java
  5. 2
      test-support/spring-boot-docker-test-support/src/main/java/org/springframework/boot/testsupport/container/TestImage.java

2
module/spring-boot-amqp/src/main/java/org/springframework/boot/amqp/autoconfigure/RabbitAmqpAutoConfiguration.java

@ -40,6 +40,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties @@ -40,6 +40,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.boot.ssl.SslBundles;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link RabbitAmqpTemplate}.
@ -50,6 +51,7 @@ import org.springframework.context.annotation.Bean; @@ -50,6 +51,7 @@ import org.springframework.context.annotation.Bean;
@AutoConfiguration
@ConditionalOnClass({ RabbitAmqpTemplate.class, Connection.class })
@EnableConfigurationProperties(RabbitProperties.class)
@Import(RabbitAnnotationDrivenConfiguration.class)
public final class RabbitAmqpAutoConfiguration {
private final RabbitProperties properties;

41
module/spring-boot-amqp/src/main/java/org/springframework/boot/amqp/autoconfigure/RabbitAnnotationDrivenConfiguration.java

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
/*
* Copyright 2012-present the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.amqp.autoconfigure;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.config.RabbitListenerConfigUtils;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Configuration;
/**
* Configuration for Spring AMQP annotation driven endpoints.
*
* @author Eddú Meléndez
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(EnableRabbit.class)
class RabbitAnnotationDrivenConfiguration {
@Configuration(proxyBeanMethods = false)
@EnableRabbit
@ConditionalOnMissingBean(name = RabbitListenerConfigUtils.RABBIT_LISTENER_ANNOTATION_PROCESSOR_BEAN_NAME)
static class EnableRabbitConfiguration {
}
}

3
smoke-test/spring-boot-smoke-test-amqp/src/dockerTest/java/smoketest/amqp/SampleRabbitAmqpSimpleApplicationTests.java

@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest; @@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.system.CapturedOutput;
import org.springframework.boot.test.system.OutputCaptureExtension;
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.boot.testsupport.container.TestImage;
import static org.assertj.core.api.Assertions.assertThat;
@ -40,7 +41,7 @@ class SampleRabbitAmqpSimpleApplicationTests { @@ -40,7 +41,7 @@ class SampleRabbitAmqpSimpleApplicationTests {
@Container
@ServiceConnection
static final RabbitMQContainer rabbit = new RabbitMQContainer("rabbitmq:4.0-management-alpine");
static final RabbitMQContainer rabbit = TestImage.container(RabbitMQContainer.class);
@Autowired
private Sender sender;

2
smoke-test/spring-boot-smoke-test-amqp/src/main/java/smoketest/amqp/SampleRabbitAmqpSimpleApplication.java

@ -20,7 +20,6 @@ import org.apache.commons.logging.Log; @@ -20,7 +20,6 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.rabbit.annotation.EnableRabbit;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.boot.ApplicationRunner;
@ -30,7 +29,6 @@ import org.springframework.context.annotation.Bean; @@ -30,7 +29,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.messaging.handler.annotation.Payload;
@SpringBootApplication
@EnableRabbit
@RabbitListener(queues = "foo")
public class SampleRabbitAmqpSimpleApplication {

2
test-support/spring-boot-docker-test-support/src/main/java/org/springframework/boot/testsupport/container/TestImage.java

@ -247,7 +247,7 @@ public enum TestImage { @@ -247,7 +247,7 @@ public enum TestImage {
/**
* A container image suitable for testing RabbitMQ.
*/
RABBITMQ("rabbitmq", "3.11-alpine", () -> RabbitMQContainer.class,
RABBITMQ("rabbitmq", "4.2.4-alpine", () -> RabbitMQContainer.class,
(container) -> ((RabbitMQContainer) container).withStartupTimeout(Duration.ofMinutes(4))),
/**

Loading…
Cancel
Save