add
This commit is contained in:
parent
d6f24d4c34
commit
8c9eb20430
|
|
@ -1,4 +1,6 @@
|
||||||
package com.ahbonus.demo4bonus;
|
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.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
@ -9,17 +11,19 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
public class GreetingController {
|
public class GreetingController {
|
||||||
|
Logger logger= LoggerFactory.getLogger(GreetingController.class);
|
||||||
private static final String TEMPLATE = "Hello my dear, %s!";
|
private static final String TEMPLATE = "Hello my dear, %s!";
|
||||||
@PostMapping("/greeting")
|
@PostMapping("/greeting")
|
||||||
|
|
||||||
public String greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
|
public String greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
|
||||||
|
logger.info("Welcome from Anhui Bonus!");
|
||||||
return String.format(TEMPLATE, name);
|
return String.format(TEMPLATE, name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/health")
|
@GetMapping("/health")
|
||||||
public String healthcheck() {
|
public String healthcheck() {
|
||||||
|
logger.info("Server Status is OK");
|
||||||
return "OKOKOK";
|
return "OKOKOK";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue