<context:component-scan base-package=com.xxx.xxx/ >包扫描注解
2015-01-09 18:36
471 查看
<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的作用域
@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的作用域
相关文章推荐
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- <context:component-scan base-package=com.xxx.xxx/ >包扫描注解
- Spring类的自动注入<context:component-scan base-package="com.**.dao" />
- Spring的配置文件applicationContext.xml中的 <context:component-scan base-package="com.orm" />
- <context:component-scan base-package="com.xx" />
- spring使用@value关于<context:component-scan base-package=”com.baidu” />的一个错误
- 关于使用注解的Spring配置文件的配置<context:annotation-config/>&&<context:component-scan base-package=”XX.XX”/>
- Spring:<context:annotation-config/>与<context:component-scan base-package="com.xx />
- spring 中<context:annotation-config />和<context:component-scan base-package="com.*" >
- Spring:<context:component-scan base-package=com.xx.yy/ >注解
- 合并注解配置 <context:component-scan base-package="com.**.controller" annotation-config="true"/>
- SpringMVC 源码深度解析<context:component-scan>(扫描和注冊的注解Bean)
- <mvc:annotation-driven/>、<context:component-scan base-package=""/>、<context:annotation-config/>的用法
- <context:component-scan base-package=""> <context:annotation-config>
- Spring配置文件详解一:<:<context:annotation-config/>与<context:component-scan base-package="com.xx