当前位置:网站首页>@Controller, @service, @repository, @component differences
@Controller, @service, @repository, @component differences
2022-07-06 10:45:00 【Programmer seven seven】
1、@controller controller ( Injection service 、 Use in Controller layer )
Used to label the control layer , amount to struts Medium action layer
2、@service service ( Inject dao、 Use in Service layer )
For tagging the service layer , It is mainly used for business logic processing
3、@repository( Realization dao visit 、 Use in Mapper layer )
Used to label data access layer , It can also be used to label data access components , namely DAO Components .
4、@component ( Put ordinary pojo Instantiate to spring In the container , Equivalent to the configuration file )
It refers to all kinds of components , That is to say, when our classes do not belong to various categories ( Do not belong to @Controller、@Services When waiting ), We can use @Component To label this class .
explain :
<context:component-scan base-package=”com.*”>
The example above is the introduction of Component Examples of components , among base-package Represents all subpackages that need to be scanned .
Common ground : By @controller 、@service、@repository 、@component Annotated classes , These classes will be included in spring Manage in containers
边栏推荐
- MySQL33-多版本并发控制
- MySQL20-MySQL的数据目录
- 评估方法的优缺点
- API learning of OpenGL (2001) gltexgen
- 保姆级手把手教你用C语言写三子棋
- 百度百科数据爬取及内容分类识别
- Water and rain condition monitoring reservoir water and rain condition online monitoring
- A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
- Why is MySQL still slow to query when indexing is used?
- 第一篇博客
猜你喜欢
Why is MySQL still slow to query when indexing is used?
MySQL22-逻辑架构
MySQL32-锁
windows无法启动MYSQL服务(位于本地计算机)错误1067进程意外终止
MySQL28-数据库的设计规范
CSDN Q & a tag skill tree (V) -- cloud native skill tree
Pytorch LSTM实现流程(可视化版本)
Invalid global search in idea/pychar, etc. (win10)
Mysql26 use of performance analysis tools
[unity] simulate jelly effect (with collision) -- tutorial on using jellysprites plug-in
随机推荐
Mysql21 - gestion des utilisateurs et des droits
API learning of OpenGL (2001) gltexgen
CSDN问答标签技能树(五) —— 云原生技能树
Time in TCP state_ The role of wait?
Mysql27 index optimization and query optimization
ByteTrack: Multi-Object Tracking by Associating Every Detection Box 论文阅读笔记()
CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)
Global and Chinese markets of static transfer switches (STS) 2022-2028: Research Report on technology, participants, trends, market size and share
C语言标准的发展
Mysql30 transaction Basics
解决扫描不到xml、yml、properties文件配置
Introduction tutorial of typescript (dark horse programmer of station B)
用于实时端到端文本识别的自适应Bezier曲线网络
保姆级手把手教你用C语言写三子棋
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
Navicat 导出表生成PDM文件
[BMZCTF-pwn] 12-csaw-ctf-2016-quals hungman
Other new features of mysql18-mysql8
Download and installation of QT Creator
CSDN question and answer tag skill tree (I) -- Construction of basic framework