1

我的服务中有一个安全的方法:

@PreAuthorize("hasRole('TRANSACTION') and hasRole('INIT_TRANSACTION') and @amountValidatorServiceBean.isAmountValidForCurrentUser(#amount)" )
public void initTransaction(Amount amount){
....
....
}

这很好用,但是当它失败时,它总是抛出一个 org.springframework.security.access.AccessDeniedException Exception 。

我想对抛出的异常有更深的粒度:

TransactionRightException // InitTransactionRightException 和 AmountTransactionException 。

有没有一种与@PreAuthorize 结合使用的干净方法。

提前致谢。

4

0 回答 0