com.example.chaos.monkey.chaosdemo.component.HelloComponent Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of chaos-monkey-web-reactive-app Show documentation
Show all versions of chaos-monkey-web-reactive-app Show documentation
Chaos Monkey for Spring Boot reactive web app
package com.example.chaos.monkey.chaosdemo.component;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.reactive.function.BodyInserters;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import reactor.core.publisher.Mono;
/** @author Benjamin Wilms */
@Component
public class HelloComponent {
public Mono hello(ServerRequest request) {
return ServerResponse.ok()
.contentType(MediaType.TEXT_PLAIN)
.body(BodyInserters.fromObject("Hello, from Component!"));
}
}