首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

Spring的注脚@Component,@Service,@Controller,@Repository

2012-11-10 
Spring的注解@Component,@Service,@Controller,@Repositorycontext:component-scan?base-package”com.mt

Spring的注解@Component,@Service,@Controller,@Repository

<context:component-scan?base-package=”com.mtea.spring”>??


其中base-package为需要扫描的包(含所有子包)?
@Service用于标注业务层组件,
@Controller用于标注控制层组件(如struts中的action),
@Repository用于标注数据访问组件,即DAO组件,
@Component泛指组件,当组件不好归类的时候,我们可以使用这个注解进行标注。



Repository

n. 贮藏室,仓库;知识库;智囊团

热点排行