Files
spring-soap/spring-aop/src/main/java/com/baeldung/method/info/BankAccountService.java
Sallo Szrajbman 5910202781 BAEL-4071 - Get advised method info in Spring AOP
Fixing identation
2020-12-19 12:58:00 +00:00

30 lines
746 B
Java

package com.baeldung.method.info;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.stereotype.Component;
@Component
public class BankAccountService {
@AccountOperation(operation = "deposit")
public void deposit(Account account, Double amount) {
account.setBalance(account.getBalance() + amount);
}
@AccountOperation(operation = "withdraw")
public void withdraw(Account account, Double amount) throws WithdrawLimitException {
if (amount > 500.0) {
throw new WithdrawLimitException("Withdraw limit exceeded.");
}
account.setBalance(account.getBalance() - amount);
}
public double getBalance() {
return RandomUtils.nextDouble();
}
}