Skip to content

Commit ee7c86a

Browse files
committed
Start building against Reactor 2.0.1 snapshots
See gh-2719
1 parent 681894a commit ee7c86a

File tree

7 files changed

+104
-84
lines changed

7 files changed

+104
-84
lines changed

spring-boot-autoconfigure/pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@
8080
<artifactId>cache-api</artifactId>
8181
<optional>true</optional>
8282
</dependency>
83+
<dependency>
84+
<groupId>io.projectreactor.spring</groupId>
85+
<artifactId>reactor-spring-context</artifactId>
86+
<optional>true</optional>
87+
</dependency>
8388
<dependency>
8489
<groupId>org.flywaydb</groupId>
8590
<artifactId>flyway-core</artifactId>
@@ -415,11 +420,6 @@
415420
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
416421
<optional>true</optional>
417422
</dependency>
418-
<dependency>
419-
<groupId>org.projectreactor.spring</groupId>
420-
<artifactId>reactor-spring-context</artifactId>
421-
<optional>true</optional>
422-
</dependency>
423423
<dependency>
424424
<groupId>javax.jms</groupId>
425425
<artifactId>jms-api</artifactId>

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfiguration.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import org.springframework.context.annotation.Bean;
2525
import org.springframework.context.annotation.Configuration;
2626

27-
import reactor.core.Environment;
28-
import reactor.core.Reactor;
27+
import reactor.Environment;
28+
import reactor.bus.EventBus;
2929
import reactor.spring.context.config.EnableReactor;
3030

3131
/**
@@ -39,15 +39,16 @@
3939
public class ReactorAutoConfiguration {
4040

4141
@Bean
42-
@ConditionalOnMissingBean(Reactor.class)
43-
public Reactor rootReactor(Environment environment) {
44-
return environment.getRootReactor();
42+
@ConditionalOnMissingBean(EventBus.class)
43+
public EventBus eventBus(Environment environment) {
44+
return EventBus.create(environment);
4545
}
4646

4747
@Configuration
4848
@ConditionalOnMissingBean(Environment.class)
4949
@EnableReactor
5050
protected static class ReactorConfiguration {
51+
5152
}
5253

5354
}

spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2014 the original author or authors.
2+
* Copyright 2012-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,43 +21,53 @@
2121
import org.springframework.context.annotation.Bean;
2222
import org.springframework.context.annotation.Configuration;
2323

24-
import reactor.core.Environment;
25-
import reactor.core.Reactor;
26-
import reactor.core.spec.Reactors;
24+
import reactor.bus.EventBus;
25+
import reactor.core.Dispatcher;
26+
import reactor.core.dispatch.MpscDispatcher;
27+
import reactor.core.dispatch.RingBufferDispatcher;
2728

28-
import static org.junit.Assert.assertNotNull;
29+
import static org.hamcrest.Matchers.instanceOf;
30+
import static org.junit.Assert.assertThat;
2931

3032
/**
3133
* Tests for {@link ReactorAutoConfiguration}.
3234
*
3335
* @author Dave Syer
36+
* @author Andy Wilkinson
3437
*/
3538
public class ReactorAutoConfigurationTests {
3639

3740
private final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
3841

3942
@Test
40-
public void reactorIsAvailable() {
43+
public void eventBusIsAvailable() {
4144
this.context.register(ReactorAutoConfiguration.class);
4245
this.context.refresh();
43-
assertNotNull(this.context.getBean(Reactor.class));
46+
EventBus eventBus = this.context.getBean(EventBus.class);
47+
assertThat(eventBus.getDispatcher(), instanceOf(RingBufferDispatcher.class));
4448
this.context.close();
4549
}
4650

4751
@Test
48-
public void customReactor() {
52+
public void customEventBus() {
4953
this.context.register(TestConfiguration.class, ReactorAutoConfiguration.class);
5054
this.context.refresh();
51-
assertNotNull(this.context.getBean(Reactor.class));
55+
EventBus eventBus = this.context.getBean(EventBus.class);
56+
assertThat(eventBus.getDispatcher(), instanceOf(MpscDispatcher.class));
5257
this.context.close();
5358
}
5459

5560
@Configuration
5661
protected static class TestConfiguration {
5762

63+
@Bean(destroyMethod = "shutdown")
64+
public Dispatcher dispatcher() {
65+
return new MpscDispatcher("test");
66+
}
67+
5868
@Bean
59-
public Reactor reactor(Environment env) {
60-
return Reactors.reactor().env(env).dispatcher(Environment.RING_BUFFER).get();
69+
public EventBus customEventBus() {
70+
return EventBus.create(dispatcher());
6171
}
6272
}
6373

spring-boot-cli/samples/reactor.groovy

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import java.util.concurrent.CountDownLatch
77
class Runner implements CommandLineRunner {
88

99
@Autowired
10-
Reactor reactor
10+
EventBus eventBus
1111

1212
private CountDownLatch latch = new CountDownLatch(1)
1313

@@ -17,7 +17,7 @@ class Runner implements CommandLineRunner {
1717
}
1818

1919
void run(String... args) {
20-
reactor.notify("hello", Event.wrap("Phil"))
20+
eventBus.notify("hello", Event.wrap("Phil"))
2121
log.info "Notified Phil"
2222
latch.await()
2323
}
@@ -34,7 +34,7 @@ class Runner implements CommandLineRunner {
3434
class Greeter {
3535

3636
@Autowired
37-
Reactor reactor
37+
EventBus eventBus
3838

3939
@Autowired
4040
private CountDownLatch latch

spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/ReactorCompilerAutoConfiguration.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,29 +32,28 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
3232
@Override
3333
public boolean matches(ClassNode classNode) {
3434
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableReactor")
35-
|| AstUtils.hasAtLeastOneFieldOrMethod(classNode, "Reactor");
35+
|| AstUtils.hasAtLeastOneFieldOrMethod(classNode, "EventBus");
3636
}
3737

3838
@Override
3939
public void applyDependencies(DependencyCustomizer dependencies) {
40-
dependencies.ifAnyMissingClasses("reactor.core.Reactor")
40+
dependencies.ifAnyMissingClasses("reactor.bus.EventBus")
4141
.add("reactor-spring-context", false).add("reactor-spring-core", false)
42-
.add("reactor-core");
42+
.add("reactor-bus").add("reactor-stream");
4343
}
4444

4545
@Override
4646
public void applyImports(ImportCustomizer imports) {
47-
imports.addImports("reactor.core.Reactor", "reactor.core.spec.Reactors",
48-
"reactor.core.Observable", "reactor.event.Event",
49-
"reactor.function.Functions", "reactor.function.Predicates",
50-
"reactor.function.Suppliers",
51-
"reactor.spring.context.annotation.Consumer",
47+
imports.addImports("reactor.bus.Bus", "reactor.bus.Event",
48+
"reactor.bus.EventBus", "reactor.fn.Function", "reactor.fn.Functions",
49+
"reactor.fn.Predicate", "reactor.fn.Predicates", "reactor.fn.Supplier",
50+
"reactor.fn.Suppliers", "reactor.spring.context.annotation.Consumer",
51+
"reactor.spring.context.annotation.ReplyTo",
5252
"reactor.spring.context.annotation.Selector",
5353
"reactor.spring.context.annotation.SelectorType",
54-
"reactor.spring.context.annotation.ReplyTo",
5554
"reactor.spring.context.config.EnableReactor")
56-
.addStarImports("reactor.event.selector.Selectors")
57-
.addImport("ReactorEnvironment", "reactor.core.Environment");
55+
.addStarImports("reactor.bus.selector.Selectors")
56+
.addImport("ReactorEnvironment", "reactor.Environment");
5857
}
5958

6059
}

spring-boot-cli/test-samples/integration_auto_test.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
class RestTests {
44

55
@Autowired
6-
Reactor reactor
6+
EventBus eventBus
77

88
@Test
99
void test() {
10-
assertNotNull(reactor)
10+
assertNotNull(eventBus)
1111
}
1212

1313
}

spring-boot-dependencies/pom.xml

Lines changed: 57 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@
110110
<mysql.version>5.1.34</mysql.version>
111111
<nekohtml.version>1.9.21</nekohtml.version>
112112
<postgresql.version>9.4-1201-jdbc41</postgresql.version>
113-
<reactor.version>1.1.6.RELEASE</reactor.version>
114-
<reactor-spring.version>1.1.3.RELEASE</reactor-spring.version>
113+
<reactor.version>2.0.1.BUILD-SNAPSHOT</reactor.version>
114+
<reactor-spring.version>2.0.1.BUILD-SNAPSHOT</reactor-spring.version>
115115
<sendgrid.version>2.1.0</sendgrid.version>
116116
<servlet-api.version>3.1.0</servlet-api.version>
117117
<simple-json.version>1.1.1</simple-json.version>
@@ -624,6 +624,61 @@
624624
<artifactId>metrics-servlets</artifactId>
625625
<version>${dropwizard-metrics.version}</version>
626626
</dependency>
627+
<dependency>
628+
<groupId>io.projectreactor</groupId>
629+
<artifactId>reactor-bus</artifactId>
630+
<version>${reactor.version}</version>
631+
</dependency>
632+
<dependency>
633+
<groupId>io.projectreactor</groupId>
634+
<artifactId>reactor-core</artifactId>
635+
<version>${reactor.version}</version>
636+
</dependency>
637+
<dependency>
638+
<groupId>io.projectreactor</groupId>
639+
<artifactId>reactor-groovy</artifactId>
640+
<version>${reactor.version}</version>
641+
</dependency>
642+
<dependency>
643+
<groupId>io.projectreactor</groupId>
644+
<artifactId>reactor-groovy-extensions</artifactId>
645+
<version>${reactor.version}</version>
646+
</dependency>
647+
<dependency>
648+
<groupId>io.projectreactor</groupId>
649+
<artifactId>reactor-logback</artifactId>
650+
<version>${reactor.version}</version>
651+
</dependency>
652+
<dependency>
653+
<groupId>io.projectreactor</groupId>
654+
<artifactId>reactor-net</artifactId>
655+
<version>${reactor.version}</version>
656+
</dependency>
657+
<dependency>
658+
<groupId>io.projectreactor</groupId>
659+
<artifactId>reactor-stream</artifactId>
660+
<version>${reactor.version}</version>
661+
</dependency>
662+
<dependency>
663+
<groupId>io.projectreactor.spring</groupId>
664+
<artifactId>reactor-spring-context</artifactId>
665+
<version>${reactor-spring.version}</version>
666+
</dependency>
667+
<dependency>
668+
<groupId>io.projectreactor.spring</groupId>
669+
<artifactId>reactor-spring-core</artifactId>
670+
<version>${reactor-spring.version}</version>
671+
</dependency>
672+
<dependency>
673+
<groupId>io.projectreactor.spring</groupId>
674+
<artifactId>reactor-spring-messaging</artifactId>
675+
<version>${reactor-spring.version}</version>
676+
</dependency>
677+
<dependency>
678+
<groupId>io.projectreactor.spring</groupId>
679+
<artifactId>reactor-spring-webmvc</artifactId>
680+
<version>${reactor-spring.version}</version>
681+
</dependency>
627682
<dependency>
628683
<groupId>io.undertow</groupId>
629684
<artifactId>undertow-core</artifactId>
@@ -1250,51 +1305,6 @@
12501305
<artifactId>postgresql</artifactId>
12511306
<version>${postgresql.version}</version>
12521307
</dependency>
1253-
<dependency>
1254-
<groupId>org.projectreactor</groupId>
1255-
<artifactId>reactor-core</artifactId>
1256-
<version>${reactor.version}</version>
1257-
</dependency>
1258-
<dependency>
1259-
<groupId>org.projectreactor</groupId>
1260-
<artifactId>reactor-groovy</artifactId>
1261-
<version>${reactor.version}</version>
1262-
</dependency>
1263-
<dependency>
1264-
<groupId>org.projectreactor</groupId>
1265-
<artifactId>reactor-groovy-extensions</artifactId>
1266-
<version>${reactor.version}</version>
1267-
</dependency>
1268-
<dependency>
1269-
<groupId>org.projectreactor</groupId>
1270-
<artifactId>reactor-logback</artifactId>
1271-
<version>${reactor.version}</version>
1272-
</dependency>
1273-
<dependency>
1274-
<groupId>org.projectreactor</groupId>
1275-
<artifactId>reactor-net</artifactId>
1276-
<version>${reactor.version}</version>
1277-
</dependency>
1278-
<dependency>
1279-
<groupId>org.projectreactor.spring</groupId>
1280-
<artifactId>reactor-spring-context</artifactId>
1281-
<version>${reactor-spring.version}</version>
1282-
</dependency>
1283-
<dependency>
1284-
<groupId>org.projectreactor.spring</groupId>
1285-
<artifactId>reactor-spring-core</artifactId>
1286-
<version>${reactor-spring.version}</version>
1287-
</dependency>
1288-
<dependency>
1289-
<groupId>org.projectreactor.spring</groupId>
1290-
<artifactId>reactor-spring-messaging</artifactId>
1291-
<version>${reactor-spring.version}</version>
1292-
</dependency>
1293-
<dependency>
1294-
<groupId>org.projectreactor.spring</groupId>
1295-
<artifactId>reactor-spring-webmvc</artifactId>
1296-
<version>${reactor-spring.version}</version>
1297-
</dependency>
12981308
<dependency>
12991309
<groupId>org.slf4j</groupId>
13001310
<artifactId>jcl-over-slf4j</artifactId>

0 commit comments

Comments
 (0)