Created
February 7, 2018 14:45
-
-
Save predic8/16a7a4cfd383e2cd9cbd3eb284fea24b to your computer and use it in GitHub Desktop.
WebFlux Config
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package de.predic8.reactiveweb; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.web.reactive.config.EnableWebFlux; | |
import org.springframework.web.reactive.config.WebFluxConfigurer; | |
import org.springframework.web.reactive.function.server.RequestPredicates; | |
import org.springframework.web.reactive.function.server.RouterFunction; | |
import org.springframework.web.reactive.function.server.RouterFunctions; | |
import org.springframework.web.reactive.function.server.ServerResponse; | |
import static org.springframework.web.reactive.function.BodyInserters.fromObject; | |
@Configuration | |
@EnableWebFlux | |
public class WebConfig implements WebFluxConfigurer { | |
@Bean | |
RouterFunction<ServerResponse> helloWorldRoute() { | |
return RouterFunctions.route(RequestPredicates.path("/hello"), | |
request -> ServerResponse.ok().body(fromObject("Hello World"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment