This commit is contained in:
yuzchen 2024-01-30 17:13:54 +08:00
parent d6f24d4c34
commit 8c9eb20430
1 changed files with 5 additions and 1 deletions

View File

@ -1,4 +1,6 @@
package com.ahbonus.demo4bonus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -9,17 +11,19 @@ import org.springframework.web.bind.annotation.RestController;
*/
@RestController
public class GreetingController {
Logger logger= LoggerFactory.getLogger(GreetingController.class);
private static final String TEMPLATE = "Hello my dear, %s!";
@PostMapping("/greeting")
public String greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
logger.info("Welcome from Anhui Bonus!");
return String.format(TEMPLATE, name);
}
@GetMapping("/health")
public String healthcheck() {
logger.info("Server Status is OK");
return "OKOKOK";
}