首页 > 编程语言 > 详细

SpringMvc 之自动注解

时间:2016-01-23 23:06:12      阅读:272      评论:0      收藏:0      [点我收藏+]

 

 

<context:component-scan/> 元素会扫描指定的包极其所有子包,并查找能够自动注册为Spring Bean的类.base-package属性标识了<context:component-scan/> 元素所扫描的包

<context:component-scan base-package="org.test">
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" />
    </context:component-scan>

 

会自动检测的标注Bean

@Component ---通用构造型注解

@Controller--标识为 spring mvc 控制器

@Repository --标识为数据仓储

@Service--标识为服务

 

 

过滤组件扫描

过滤器组件

<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" />---不需要注册为bean

SpringMvc 之自动注解

原文:http://www.cnblogs.com/ilooking/p/5154271.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!