springMVC的注入方式有哪几种,这与springMVC依赖

2022-03-22 社会 66阅读
3种方法
1。构造器注入
publicclassxx{
privateManagermanage;
publicxx(Managermanage){
this.manage=manage;
}
}

2.setter方法注入
publicclassxx{
privateManagermanage;
publicvoidsetManager(Managermanage){
this.manage=manage;
}
}

3.接口注入
publicinterfaceManager{
publicvoidmanage(Businessbusiness);
}
publicclassxx{
privateBusinessbusiness;
publicvoidmanage(Businessbusiness){
this.business=business;
}
}
声明:你问我答网所有作品(图文、音视频)均由用户自行上传分享,仅供网友学习交流。若您的权利被侵害,请联系fangmu6661024@163.com