Files
spring-boot-rest/spring-5-reactive-netty/src/main/java/com/baeldung/serverconfig/server/GreetingController.java

24 lines
714 B
Java

package com.baeldung.serverconfig.server;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;
@RestController
@RequestMapping("/greet")
public class GreetingController {
private final GreetingService greetingService;
public GreetingController(GreetingService greetingService) {
this.greetingService = greetingService;
}
@GetMapping("/{name}")
private Mono<String> greet(@PathVariable String name) {
return greetingService.greet(name);
}
}