Skip to content

Commit d4c8377

Browse files
committed
SF to 5.0.1.B-S and Fix @eventlistener tests
Framework classes must be `@Component` to use `@EventListener`.
1 parent bdc75e4 commit d4c8377

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ subprojects { subproject ->
8585
rabbitmqVersion = project.hasProperty('rabbitmqVersion') ? project.rabbitmqVersion : '5.3.0'
8686
rabbitmqHttpClientVersion = '2.1.0.RELEASE'
8787

88-
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.1.0.RC1'
88+
springVersion = project.hasProperty('springVersion') ? project.springVersion : '5.1.0.BUILD-SNAPSHOT'
8989

9090
springRetryVersion = '1.2.2.RELEASE'
9191
}

spring-rabbit/src/test/java/org/springframework/amqp/rabbit/annotation/EnableRabbitIdleContainerTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import org.springframework.context.annotation.Bean;
4646
import org.springframework.context.annotation.Configuration;
4747
import org.springframework.context.event.EventListener;
48+
import org.springframework.stereotype.Component;
4849
import org.springframework.test.annotation.DirtiesContext;
4950
import org.springframework.test.context.ContextConfiguration;
5051
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -131,6 +132,7 @@ public Listener listener() {
131132

132133
}
133134

135+
@Component
134136
public static class Listener {
135137

136138
private final Log logger = LogFactory.getLog(this.getClass());

spring-rabbit/src/test/java/org/springframework/amqp/rabbit/listener/BrokerEventListenerTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@
3535
import org.springframework.amqp.rabbit.junit.RabbitAvailable;
3636
import org.springframework.amqp.rabbit.junit.RabbitAvailableCondition;
3737
import org.springframework.beans.factory.annotation.Autowired;
38+
import org.springframework.context.ApplicationListener;
3839
import org.springframework.context.annotation.Bean;
3940
import org.springframework.context.annotation.Configuration;
40-
import org.springframework.context.event.EventListener;
4141
import org.springframework.test.annotation.DirtiesContext;
4242
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
4343

@@ -88,7 +88,7 @@ private void doTestEvents() throws Exception {
8888
}
8989

9090
@Configuration
91-
public static class Config {
91+
public static class Config implements ApplicationListener<BrokerEvent> {
9292

9393
private final CountDownLatch latch = new CountDownLatch(3);
9494

@@ -104,8 +104,8 @@ public ConnectionFactory connectionFactory() {
104104
return new CachingConnectionFactory(RabbitAvailableCondition.getBrokerRunning().getConnectionFactory());
105105
}
106106

107-
@EventListener
108-
public void listener(BrokerEvent event) {
107+
@Override
108+
public void onApplicationEvent(BrokerEvent event) {
109109
this.events.put(event.getEventType(), event.getEventProperties());
110110
this.latch.countDown();
111111
}

0 commit comments

Comments
 (0)