当前位置:网站首页>@controller,@service,@repository,@component区别
@controller,@service,@repository,@component区别
2022-07-06 09:12:00 【程序员柒七】
1、@controller 控制器(注入服务、用在Controller层)
用于标注控制层,相当于struts中的action层
2、@service 服务(注入dao、用在Service层)
用于标注服务层,主要用来进行业务的逻辑处理
3、@repository(实现dao访问、用在Mapper层)
用于标注数据访问层,也可以说用于标注数据访问组件,即DAO组件.
4、@component (把普通pojo实例化到spring容器中,相当于配置文件中的 )
泛指各种组件,就是说当我们的类不属于各种归类的时候(不属于@Controller、@Services等的时候),我们就可以使用@Component来标注这个类。
说明:
<context:component-scan base-package=”com.*”>
上面的这个例子是引入Component组件的例子,其中base-package表示为需要扫描的所有子包。
共同点:被@controller 、@service、@repository 、@component 注解的类,都会把这些类纳入进spring容器中进行管理
边栏推荐
- 基于Pytorch肺部感染识别案例(采用ResNet网络结构)
- Complete web login process through filter
- How to change php INI file supports PDO abstraction layer
- Good blog good material record link
- [leectode 2022.2.13] maximum number of "balloons"
- Set shell script execution error to exit automatically
- Export virtual machines from esxi 6.7 using OVF tool
- Solution to the problem of cross domain inaccessibility of Chrome browser
- Bytetrack: multi object tracking by associating every detection box paper reading notes ()
- Anaconda3 installation CV2
猜你喜欢
![[unity] simulate jelly effect (with collision) -- tutorial on using jellysprites plug-in](/img/1f/93a6c6150ec2b002f667a882569b7b.jpg)
[unity] simulate jelly effect (with collision) -- tutorial on using jellysprites plug-in

Mysql23 storage engine

Super detailed steps for pushing wechat official account H5 messages

ByteTrack: Multi-Object Tracking by Associating Every Detection Box 论文阅读笔记()

A necessary soft skill for Software Test Engineers: structured thinking

Mysql28 database design specification

MySQL20-MySQL的数据目录

解决在window中远程连接Linux下的MySQL

Water and rain condition monitoring reservoir water and rain condition online monitoring

MySQL real battle optimization expert 11 starts with the addition, deletion and modification of data. Review the status of buffer pool in the database
随机推荐
Unicode decodeerror: 'UTF-8' codec can't decode byte 0xd0 in position 0 successfully resolved
MySQL combat optimization expert 06 production experience: how does the production environment database of Internet companies conduct performance testing?
[untitled]
Mysql28 database design specification
Mysql27 - Optimisation des index et des requêtes
MySQL 29 other database tuning strategies
软件测试工程师必备之软技能:结构化思维
Typescript入门教程(B站黑马程序员)
Use of dataset of pytorch
Baidu Encyclopedia data crawling and content classification and recognition
MySQL storage engine
Global and Chinese market of transfer switches 2022-2028: Research Report on technology, participants, trends, market size and share
API learning of OpenGL (2004) gl_ TEXTURE_ MIN_ FILTER GL_ TEXTURE_ MAG_ FILTER
MySQL18-MySQL8其它新特性
使用OVF Tool工具从Esxi 6.7中导出虚拟机
[unity] simulate jelly effect (with collision) -- tutorial on using jellysprites plug-in
Global and Chinese market of operational amplifier 2022-2028: Research Report on technology, participants, trends, market size and share
好博客好资料记录链接
Super detailed steps for pushing wechat official account H5 messages
Set shell script execution error to exit automatically