publicclassRetryTemplateTest{publicstaticvoidmain(String[] args)throwsInterruptedException{Object ans =newRetryTemplate(){@OverrideprotectedObjectdoBiz()throwsException{int temp =(int)(Math.random()*10);System.out.println("temp="+temp);if(temp >3){thrownewException("generate value bigger then 3! need retry");}return temp;}}.setRetryCount(10).setSleepTime(10).execute();System.out.println("ans={}"+ans);}}