<context:component-scan base-package=com.xxx.xxx/ >包扫描注解
分类:<context:component-scan base-package=com.xxx.xxx/ >包扫描注解spring学习
(615) (0)
<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的作用域
转载请注明原文地址: https://ju.6miu.com/read-1297030.html