小编ama*_*man的帖子

在反应日选择器输入中修改输入字段的宽度

是否可以更改 DayPickerInput 输入字段的默认宽度?如果是,那么我怎样才能实现它?我不确定我们是否可以使用overlayComponent 做到这一点。

react-day-picker

5
推荐指数
1
解决办法
4476
查看次数

如何拦截spring aop中aspect抛出的异常

有没有办法拦截异常并向最终客户显示有意义的消息?我正在尝试使用 spring AOP 授权我的 api,如果最终用户无权访问该 API,我将抛出异常。

@Aspect
public class AuthorizationAspect {
  @Pointcut("@annotation(AuthenticateAccount)")
    public void authorized() {}

   private boolean isAuthorized() {
   // logic to check is user is authorised to call the api
   }

    @Before("authorized()")
    public void beforeControllerCall(JoinPoint joinPoint) throws UnauthorizedException {

        if(!isAuthorized)) {
            throw new UnauthorizedException("You don't have rights over this API");
        }

    }
}
Run Code Online (Sandbox Code Playgroud)

通过抛出异常,我能够阻止对 API 的访问,但它不会返回我试图抛出异常的有意义的消息。

有没有人处理过这样的用例并可以帮助我解决这个问题?

java spring aspectj

3
推荐指数
1
解决办法
7716
查看次数

标签 统计

aspectj ×1

java ×1

react-day-picker ×1

spring ×1