一、该问题的重现步骤是什么?
1. 仿照ApiLog注解自己写了一个WzApiLog注解
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface WzApiLog {
/**
* 日志描述
*
* @return {String}
*/
String value() default "日志记录";
}
2. 仿照ApiLogAspect自己写了一个WzApiLogAspect
@Slf4j
@Aspect
public class WzApiLogAspect {
@Around("@annotation(wzApiLog)")
public Object around(ProceedingJoinPoint point, WzApiLog apiLog) throws Throwable {
// 自定义业务
//执行方法
Object result = point.proceed();
// 自定义业务
return result;
}
}
3. 把WzApiLog注解加到了Controller的方法上
/**
* 控制器
*
*/
@NonDS
@RestController
@AllArgsConstructor
@RequestMapping(CommonConstant.APPLICATION_BIZ_NAME + "/message")
@Tag(name = "消息", description = "消息")
public class MessageController extends BladeController {
private final IMessageService messageService;
/**
* 已读消息
*/
@PostMapping("/read")
@ApiOperationSupport(order = 3)
@WzApiLog("wz消息-修改已读状态")
@Operation(summary = "已读", description = "传入ids")
public R<Boolean> read(String ids) {
return R.status(messageService.read(ids));
}
}
二、你期待的结果是什么?实际看到的又是什么?
期待请求该API接口时进入自己写的WzApiLogAspect切片的around方法里,实际却没有进去。换成@ApiLog注解就能进到ApiLogAspect切片的arountd方法里。请问是什么原因,怎么解决?
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
BladeX-Boot 4.7.0.RELEASE win10
四、请提供详细的错误堆栈信息,这很重要。
五、若有更多详细信息,请在下面提供。
扫一扫访问 Blade技术社区 移动端