SpringMVC 【<context:component-scan/>】

<context:component-scan/> 扫描指定的包中的类上的注解,常用的注解有:

  @Controller 声明Action组件
  @Service    声明Service组件    @Service("myMovieLister") 
  @Repository 声明Dao组件
@Component   泛指组件, 当不好归类时. 
@RequestMapping("/menu")  请求映射
@Resource  用于注入,( j2ee提供的 ) 默认按名称装配,@Resource(name="beanName") 
@Autowired 用于注入,(srping提供的) 默认按类型装配 
@Transactional( rollbackFor={Exception.class}) 事务管理
@ResponseBody
@Scope("prototype")   设定bean的作用域

posted @ 2014-04-03 16:14  聆听自由  阅读(266)  评论(0编辑  收藏  举报