</p> private AppContext() {2 X; O5 e2 p- }0 E
this.appContext = new ClassPathXmlApplicationContext(; U/ K% a% j9 u( u, y
"/applicationContext.xml");+ D, I# _$ {2 x! E" | p/ y- D& _
}& N$ [, ^/ d2 z; I1 B4 G, f+ M
public AbstractApplicationContext getAppContext() {
# I: b8 u% C4 P" u. } return appContext;# g8 T" D( O( _9 I+ @
}
8 {& n' a4 q @" W/ Z2 _ }
! \8 T3 s. m+ X; |( N7 ]* a3 e! @3 n三、自界说调剂使命类,担任TimerTask 类
% [* C, U7 l4 j import java.util.TimerTask;3 l8 H3 T8 R5 K4 l, ~- s
public class EarlyWarningTask extends TimerTask {
. v2 D$ A$ _) q8 g private static final int C_SCHEDULE_HOUR = 23;//执行时刻23时5 ~4 O) |; a% J2 ]% A3 k a" e7 T
private static boolean isRunning = false;
) d4 c2 i9 T& {; M! S: G //经由过程AppContext 类,获得设置装备摆设文件中相关营业体例1 l6 G2 o' C$ U N
//inStorageDetailImp' G( W# b, `# F* E# G/ L- `; E
protected IInStorageDetailService getInStorageDetailService(){' e. Y* T, f" k8 }
return (IInStorageDetailService)AppContext.getInstance().getAppContext()! t& X! n6 a+ _4 D" ?4 D( H0 r
.getBean("inStorageDetailImp");+ |! I' B* q2 g1 Y
}
- d. F+ B: |9 v% O9 W; S) i/ } // goodsWarningImp# {( Z7 o$ ~( d8 F+ C' D/ Z, m
protected IGoodsWarningService getGoodsWarningService(){# `$ X0 H; p5 [
return (IGoodsWarningService)AppContext.getInstance().getAppContext()
S- o- _3 a3 n3 ?% u/ E .getBean("goodsWarningImp");
, Z! @' M! U6 v- w8 K, |1 f }
3 [4 T# y1 d7 A M // lendOutAccountImp
1 S: h8 w9 f8 \# J6 q protected ILendOutAccountService getLendOutAccountService(){ S& ]! e2 |, [- l
return (ILendOutAccountService) AppContext.getInstance().getAppContext()
7 X r5 I( V2 m3 R: _; Q- Q .getBean("lendOutAccountImp");
' c$ v9 U! ^/ S6 J ^$ Z# w( h) U3 s+ M3 M) i$ B
} |