当前位置:网站首页>@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
边栏推荐
- Mysql30 transaction Basics
- February 13, 2022-3-middle order traversal of binary tree
- MySQL33-多版本并发控制
- Kubernetes - problems and Solutions
- Mysql33 multi version concurrency control
- 解决:log4j:WARN Please initialize the log4j system properly.
- ByteTrack: Multi-Object Tracking by Associating Every Detection Box 论文阅读笔记()
- How to change php INI file supports PDO abstraction layer
- C language string function summary
- [reading notes] rewards efficient and privacy preserving federated deep learning
猜你喜欢

Valentine's Day is coming, are you still worried about eating dog food? Teach you to make a confession wall hand in hand. Express your love to the person you want

Pytoch LSTM implementation process (visual version)

Mysql33 multi version concurrency control

CSDN question and answer module Title Recommendation task (II) -- effect optimization

Mysql34 other database logs

MySQL26-性能分析工具的使用

CSDN-NLP:基于技能树和弱监督学习的博文难度等级分类 (一)

【博主推荐】C#生成好看的二维码(附源码)

Mysql27 - Optimisation des index et des requêtes

MySQL35-主从复制
随机推荐
Solve the problem that XML, YML and properties file configurations cannot be scanned
A brief introduction to the microservice technology stack, the introduction and use of Eureka and ribbon
API learning of OpenGL (2001) gltexgen
CSDN问答标签技能树(一) —— 基本框架的构建
API learning of OpenGL (2003) gl_ TEXTURE_ WRAP_ S GL_ TEXTURE_ WRAP_ T
解决:log4j:WARN Please initialize the log4j system properly.
Mysql22 logical architecture
pytorch的Dataset的使用
ByteTrack: Multi-Object Tracking by Associating Every Detection Box 论文阅读笔记()
MySQL25-索引的创建与设计原则
MySQL transaction log
CSDN问答模块标题推荐任务(二) —— 效果优化
Just remember Balabala
Windchill configure remote Oracle database connection
Mysql21 user and permission management
MySQL完全卸载(Windows、Mac、Linux)
MySQL21-用戶與權限管理
MySQL27-索引優化與查詢優化
Typescript入门教程(B站黑马程序员)
Mysql30 transaction Basics