|
|
vor 4 Jahren | |
|---|---|---|
| src | vor 4 Jahren | |
| README.md | vor 4 Jahren | |
| pom.xml | vor 4 Jahren |
Print logs of http request using spring aop
Dependency
<dependency>
<groupId>com.uas.ps</groupId>
<artifactId>ps-httplog</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
Configuration
@EnableHttpLog
public class Application {
// code
}
HTTP api
@RestController
@RequestMapping("/api")
public class MyApi{
@GetMapping("/test/{id}")
@HttpLog(exclude = {"age"}, includeHeaders = {"name"}, excludeResult = true)
public Map<String, Object> test(@PathVariable("id") int id,
@RequestParam("age") int age,
@RequestHeader("name") String name,
@RequestHeader("password") String password){
Map<String, Object> result = new HashMap<>();
result.put("id", id);
result.put("age", age);
result.put("name", name);
result.put("password", password);
return result;
}
}