This commit is contained in:
yuzchen 2024-01-30 16:09:36 +08:00
parent c040298321
commit d6f24d4c34
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
package com.ahbonus.demo4bonus; package com.ahbonus.demo4bonus;
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.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -10,7 +11,7 @@ import org.springframework.web.bind.annotation.RestController;
public class GreetingController { public class GreetingController {
private static final String TEMPLATE = "Hello my dear, %s!"; private static final String TEMPLATE = "Hello my dear, %s!";
@GetMapping("/greeting") @PostMapping("/greeting")
public String greeting(@RequestParam(value = "name", defaultValue = "World") String name) { public String greeting(@RequestParam(value = "name", defaultValue = "World") String name) {
return String.format(TEMPLATE, name); return String.format(TEMPLATE, name);

View File

@ -3,6 +3,7 @@ server:
tomcat: tomcat:
accesslog: accesslog:
enabled: true enabled: true
#reference https://blog.csdn.net/xxj_jing/article/details/134885361
pattern: '%{yyyy-MM-dd HH:mm:ss}t %a %A %m %s %D %b %I %U%q %{User-Agent}i' pattern: '%{yyyy-MM-dd HH:mm:ss}t %a %A %m %s %D %b %I %U%q %{User-Agent}i'
# directory: /Users/chenyuzhen/tomcatlog/demo4bonus/ # directory: /Users/chenyuzhen/tomcatlog/demo4bonus/
directory: /opt/webapps/logs/demo4bonus/ directory: /opt/webapps/logs/demo4bonus/