Rationalize the Reactor autoconfig

It didn't make sense not to do anything at all if a Reactor @Bean
was detected, so now we only back off creating the rootReactor if
one is present.
This commit is contained in:
Dave Syer
2014-06-05 12:52:23 +01:00
parent 36e0d44eb2
commit 32dff415c3
3 changed files with 31 additions and 8 deletions

View File

@@ -31,7 +31,8 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
@Override
public boolean matches(ClassNode classNode) {
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableReactor") || AstUtils.hasAtLeastOneFieldOrMethod(classNode, "Reactor");
return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableReactor")
|| AstUtils.hasAtLeastOneFieldOrMethod(classNode, "Reactor");
}
@Override
@@ -43,15 +44,16 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
@Override
public void applyImports(ImportCustomizer imports) {
imports.addImports("reactor.core.Reactor", "reactor.event.Event",
"reactor.function.Consumer", "reactor.function.Functions",
"reactor.event.selector.Selectors",
imports.addImports("reactor.core.Reactor", "reactor.core.spec.Reactors",
"reactor.core.Observable", "reactor.event.Event",
"reactor.function.Functions", "reactor.function.Predicates",
"reactor.function.Suppliers",
"reactor.spring.context.annotation.Consumer",
"reactor.spring.context.annotation.Selector",
"reactor.spring.context.annotation.SelectorType",
"reactor.spring.context.annotation.ReplyTo",
"reactor.spring.context.config.EnableReactor")
.addStarImports("reactor.event.Selectors")
.addStarImports("reactor.event.selector.Selectors")
.addImport("ReactorEnvironment", "reactor.core.Environment");
}