Compare commits

...

2 Commits

Author SHA1 Message Date
yuzchen f110dd8019 add 2024-01-30 17:14:38 +08:00
yuzchen 8c9eb20430 add 2024-01-30 17:13:54 +08:00
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";
}