mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Upgrade to Reactor 1.0.0.M2
This commit is contained in:
parent
082678d660
commit
5fa0166dea
@ -23,12 +23,10 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
|
||||
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
import reactor.core.Environment;
|
||||
import reactor.core.Reactor;
|
||||
import reactor.spring.context.ConsumerBeanPostProcessor;
|
||||
import reactor.spring.context.config.EnableReactor;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Reactor.
|
||||
@ -36,25 +34,15 @@ import reactor.spring.context.ConsumerBeanPostProcessor;
|
||||
* @author Dave Syer
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnClass(ConsumerBeanPostProcessor.class)
|
||||
@ConditionalOnClass(EnableReactor.class)
|
||||
@ConditionalOnMissingBean(Reactor.class)
|
||||
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
|
||||
@EnableReactor
|
||||
public class ReactorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public Environment reactorEnvironment() {
|
||||
return new Environment();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Reactor rootReactor() {
|
||||
return reactorEnvironment().getRootReactor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Order(Ordered.LOWEST_PRECEDENCE)
|
||||
protected ConsumerBeanPostProcessor reactorConsumerBeanPostProcessor() {
|
||||
return new ConsumerBeanPostProcessor();
|
||||
public Reactor rootReactor(Environment environment) {
|
||||
return environment.getRootReactor();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -14,12 +14,6 @@ class Runner implements CommandLineRunner {
|
||||
@PostConstruct
|
||||
void init() {
|
||||
log.info "Registering consumer"
|
||||
reactor.on(Selectors.$("hello"), [
|
||||
accept: {
|
||||
log.info("Hello ${it.data}")
|
||||
latch.countDown()
|
||||
}
|
||||
] as Consumer)
|
||||
}
|
||||
|
||||
void run(String... args) {
|
||||
@ -28,9 +22,10 @@ class Runner implements CommandLineRunner {
|
||||
latch.await()
|
||||
}
|
||||
|
||||
// @On(reactor="reactor", selector="hello")
|
||||
void receive(Event<String> event) {
|
||||
log.info "Hello ${event.data}"
|
||||
@Selector(reactor="reactor", value="hello")
|
||||
void receive(String data) {
|
||||
log.info "Hello ${data}"
|
||||
latch.countDown()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,6 @@
|
||||
|
||||
package org.springframework.boot.cli.compiler.autoconfigure;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.codehaus.groovy.ast.ClassNode;
|
||||
import org.codehaus.groovy.control.customizers.ImportCustomizer;
|
||||
import org.springframework.boot.cli.compiler.AstUtils;
|
||||
@ -54,17 +48,10 @@ public class ReactorCompilerAutoConfiguration extends CompilerAutoConfiguration
|
||||
public void applyImports(ImportCustomizer imports) {
|
||||
imports.addImports("reactor.core.Reactor", "reactor.event.Event",
|
||||
"reactor.function.Consumer", "reactor.function.Functions",
|
||||
"reactor.event.selector.Selectors",
|
||||
"reactor.spring.context.annotation.On",
|
||||
"reactor.spring.context.annotation.Reply",
|
||||
EnableReactor.class.getCanonicalName()).addStarImports(
|
||||
"reactor.event.selector.Selectors", "reactor.spring.annotation.Selector",
|
||||
"reactor.spring.annotation.ReplyTo",
|
||||
"reactor.spring.context.config.EnableReactor").addStarImports(
|
||||
"reactor.event.Selectors");
|
||||
}
|
||||
|
||||
@Target(ElementType.TYPE)
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public static @interface EnableReactor {
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
<tomcat.version>7.0.42</tomcat.version>
|
||||
<jetty.version>8.1.9.v20130131</jetty.version>
|
||||
<aspectj.version>1.7.3</aspectj.version>
|
||||
<reactor.version>1.0.0.M1</reactor.version>
|
||||
<reactor.version>1.0.0.M2</reactor.version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
|
@ -290,11 +290,6 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
<profile>
|
||||
|
Loading…
Reference in New Issue
Block a user