Skip to content

Commit ec3c5b5

Browse files
author
Dave Syer
committed
Add auto compile tweaks for reactor
1 parent 9cf5905 commit ec3c5b5

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ dependency-reduced-pom.xml
1515
build.log
1616
_site/
1717
.*.md.html
18+
manifest.yml

spring-boot-cli/samples/reactor.groovy

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
package org.test
22

3+
import java.util.concurrent.CountDownLatch;
4+
35
@EnableReactor
46
@Log
57
class Runner implements CommandLineRunner {
68

79
@Autowired
810
Reactor reactor
11+
12+
private CountDownLatch latch = new CountDownLatch(1)
13+
14+
@PostConstruct
15+
void init() {
16+
log.info "Registering consumer"
17+
reactor.on(Selectors.$("hello"), [
18+
accept: {
19+
log.info("Hello ${it.data}")
20+
latch.countDown()
21+
}
22+
] as Consumer)
23+
}
924

1025
void run(String... args) {
1126
reactor.notify("hello", Event.wrap("Phil"))
1227
log.info "Notified Phil"
28+
latch.await()
1329
}
1430

15-
@On(reactor="reactor", selector="hello")
31+
// @On(reactor="reactor", selector="hello")
1632
void receive(Event<String> event) {
1733
log.info "Hello ${event.data}"
1834
}

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ public void applyDependencies(DependencyCustomizer dependencies) {
5353
@Override
5454
public void applyImports(ImportCustomizer imports) {
5555
imports.addImports("reactor.core.Reactor", "reactor.event.Event",
56+
"reactor.function.Consumer", "reactor.function.Functions",
57+
"reactor.event.selector.Selectors",
5658
"reactor.spring.context.annotation.On",
5759
"reactor.spring.context.annotation.Reply",
58-
EnableReactor.class.getCanonicalName());
60+
EnableReactor.class.getCanonicalName()).addStarImports(
61+
"reactor.event.Selectors");
5962
}
6063

6164
@Target(ElementType.TYPE)

spring-boot-integration-tests/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<main.basedir>${basedir}/..</main.basedir>
1414
</properties>
1515
<dependencies>
16-
<!-- Ensure other reactor projects are build before running integration tests -->
16+
<!-- Ensure other reactor projects are built before running integration tests -->
1717
<dependency>
1818
<groupId>${project.groupId}</groupId>
1919
<artifactId>spring-boot</artifactId>
@@ -104,7 +104,7 @@
104104
<build>
105105
<plugins>
106106
<plugin>
107-
<!-- Invoke integration tests in the install phase, after the spring-package-maven-plugin is available -->
107+
<!-- Invoke integration tests in the install phase, after the maven-plugin is available -->
108108
<artifactId>maven-invoker-plugin</artifactId>
109109
<configuration>
110110
<settingsFile>src/it/settings.xml</settingsFile>

0 commit comments

Comments
 (0)