Created
December 9, 2015 02:31
-
-
Save yanickxia/693fc2684fc3a65ac915 to your computer and use it in GitHub Desktop.
Final_Method_In_Abstart_Class
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class BaseLoaneeRepayment implements Repayment { | |
@Autowired | |
protected LoanRepository loanRepository; | |
@Transactional(propagation = Propagation.REQUIRES_NEW) | |
public final void repay(RepaymentInfo repaymentInfo) { | |
Loan loan = loanRepository.lockAndLoad(repaymentInfo.getLoan().id()); | |
} | |
protected abstract void preCheck(final RepaymentInfo repaymentInfo); | |
protected abstract void updateLoanee(final RepaymentInfo repaymentInfo); | |
protected abstract void repayment(final RepaymentInfo repaymentInfo); | |
protected abstract void calcDifference(final RepaymentInfo repaymentInfo); | |
} | |
@Service("loaneeNormalRepayment") | |
public class NormalRepayment extends BaseLoaneeRepayment implements Repayment { | |
@Override | |
public final void preCheck(RepaymentInfo repaymentInfo) {} | |
@Override | |
public final void updateLoanee(RepaymentInfo repaymentInfo) {} | |
@Override | |
public final void repayment(RepaymentInfo repaymentInfo) {} | |
@Override | |
public final void calcDifference(RepaymentInfo repaymentInfo) {} | |
} | |
@TransactionConfiguration(defaultRollback = true) | |
public class NormalRepaymentTest extends ServiceTest { | |
@Autowired | |
@Qualifier("normalRepayment2") | |
private NormalRepayment normalRepayment; | |
@Autowired | |
private LoanService loanService; | |
@Test | |
public void test() { | |
normalRepayment.repay(repaymentInfo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment