@Component @Service @Controller @Repository注解使用
来源:互联网 发布:mac linux双系统 编辑:程序博客网 时间:2024/05/21 22:24
阿里云服务器购买!
@Component 相当于实例化类的对象,相当于在配置文件中注入了一个bean
要使用自动扫描机制,我们在spring的配置文件中应该如下配置:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd">
注意:表示扫描com.fangleijiang包以及它的子包
四个注解的区别:
@Service用于标注业务层组件、
@Controller用于标注控制层组件(如Struts中的action)
@Repository用于标注数据访问组件即DAO组件
@Component泛指组件,当组件不好归类的时候我们可以使用这个注解进行标注,(现在可以都用此注解)
- @Component @Service @Controller @Repository注解使用
- @Component @Service @Controller @Repository注解使用
- 使用component,repository,Service,controller注解
- @Component @Service @Controller @Repository注解使用
- Spring注解@Component、@Repository、@Service、@Controller使用
- 注解@Component @Controller @Service @Repository
- 注解@Component,@Controller,@Service,@Repository
- @Component,@Service,@Controller,@Repository注解
- Spring注解的使用和区别:@Component、@Service、@Repository、@Controller
- Spring注解的使用和区别:@Component、@Service、@Repository、@Controller
- Spring注解使用以及@Component、@Repository、@Service、@Controller区别
- spring注解-@Component(不推荐使用)、@Repository、@Service、@Controller
- Spring注解@Component、@Repository、@Service、@Controller区别
- Spring注解@Component、@Repository、@Service、@Controller区别
- Spring 注解@Component,@Service,@Controller,@Repository
- Spring 注解@Component,@Service,@Controller,@Repository
- Spring注解@Component、@Repository、@Service、@Controller区别
- Spring注解@Component、@Repository、@Service、@Controller区别
- java中深拷贝和浅拷贝的区别
- poj 1185 炮兵阵地
- Android学习篇章25-Intentc传输数据Bundle-Parcelable-Serializable
- MD5加密算法,在网上看了看,整理了一段小代码,以后直接拿来用
- 虚拟机网络设置详解
- @Component @Service @Controller @Repository注解使用
- Linux 进程调度机制(1)
- 2013上半年智能电视市场调研报告分析
- OC语法之NSDictionary
- 让对方qq一分钟内over掉
- LINUX进程调度(2)
- LINUX系统调用
- MFC类库学习——CSliderCtrl的学习
- LINUX虚拟文件系统