代码拉取完成,页面将自动刷新
需要在指定接口的前后处理一些与业务逻辑无关的事务,并且不会影响业务逻辑的运行。例如日志记录,性能监控,访问拦截、权限控制(基于Api的权限控制)等等。
<dependency>
<groupId>com.gitee.practice-pine</groupId>
<artifactId>appoint-api-spring-boot-start</artifactId>
<version>1.0-RELEASES</version>
</dependency>
@Slf4j
@Component
public class AppointApiTestA implements AppointApiMapper {
@Override
public String before(Object[] objects, HttpServletRequest httpServletRequest) {
log.info("AppointApiTestA -> before");
for (Object object : objects) {
log.info("inParam -> {}" , JSON.toJSONString(object));
}
return "11";
}
@Override
public void after(String s, Object o) {
log.info("AppointApiTestA -> after");
log.info("logId -> {}" , JSON.toJSONString(s));
log.info("outParam -> {}" , JSON.toJSONString(o));
}
@Override
public void afterThrowing(String s, Throwable throwable) {
log.info("AppointApiTestA -> afterThrowing");
log.info("logId -> {}" , JSON.toJSONString(s));
log.info("Throwable -> {}" , JSON.toJSONString(throwable));
}
@Override
public void finalProcess(Object[] objects, Object o, Throwable throwable, AppointApiProperty appointApiProperty, Method method) {
log.info("AppointApiTestA -> finalProcess");
for (Object object : objects) {
log.info("inParam -> {}" , JSON.toJSONString(object));
}
log.info("outParam -> {}" , JSON.toJSONString(o));
log.info("Throwable -> {}" , JSON.toJSONString(throwable));
log.info("AppointApiProperty -> {}" , JSON.toJSONString(appointApiProperty));
log.info("Method -> {}" , JSON.toJSONString(method));
}
}
appoint:
logger:
properties:
- apiGroupName: A
loggingType: bean
loggingPath: cn.edu.lnpu.config.aop.AppointApiTestA
4 指定Api
@AppointApi(apiGroupName = "A")
@PostMapping("/getAll")
@CrossOrigin
public ResidentQueryOutDto getAll(@RequestBody ResidentQueryInDto inDto) {
return outDto;
}
上述步骤是实现单组的,如果需要实现多组,请重复2,3,4步。
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。