当前位置:网站首页>注解用法含义
注解用法含义
2022-07-31 03:00:00 【杰拉德·皮克·谢】
根据层次来解释说明前后端分离
后端
XXApplication层
- @SpringBootApplication SpringBoot程序入口
// 注解后加括号字段为扫描指定的包
@SpringBootApplication(scanBasePackages = "com.zaofeng.good")
@EnableEurekaClient // 服务提供者
@EnableDiscoveryClient // 服务消费者
@EnableEurekaClient,@EnableDiscoveryClient两者区别
- @EnableFeignClients // 启用feign客户端
- @MapperScan(basePackages = {“com.zaofeng.good.common.mapper”, “com.zaofeng.good.service.digiccy.mapper” }) // 作用:指定要变成实现类的接口所在的包,然后包下面的所有接口在编译之后都会生成相应的实现类。添加位置:是在Springboot启动类上面添加
- @EnableSwagger2 //表示开启 Swagger
Mapper(DAO)层
- @Repository // Spring 自 2.0 版本开始,陆续引入了一些注解用于简化 Spring 的开发。@Repository注解便属于最先引入的一批,它用于将数据访问层 (DAO 层 ) 的类标识为 Spring Bean。具体只需将该注解标注在 DAO类上即可。同时,为了让 Spring 能够扫描类路径中的类并识别出 @Repository 注解,需要在 XML 配置文件中启用Bean 的自动扫描功能,这可以通过context:component-scan/实现。
- @CacheNamespace// 开启二级缓存
@CacheNamespace(implementation = RedisCache.class)
Service(层)
impl
@Service
@Service解释@Autowired // 建立连接 Servic 和 Dao(浅显理解)
@Autowired解释@Override // 重写方法
@Overrid详解@Transactional
@Transactional(readOnly = true) // 只读
Controller(层)
@Controller
@RestController
@Controller和@RestController的区别@Autowired // 通常是和Service产生关系
@RequestMapping
@RequestMapping详解@ApiOperation(value = “交易所列表”)。。。 // 文档注解
@ApiOperation(value = "交易所列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNum", value = "页码", required = true, dataType = "int", paramType = "path"),
@ApiImplicitParam(name = "pageSize", value = "笔数", required = true, dataType = "int", paramType = "path"),
@ApiImplicitParam(name = "tbDigiccyExchangeJson", value = "对象 JSON 格式", required = false, dataTypeClass = String.class, paramType = "json")
})
前
边栏推荐
- 【编译原理】递归下降语法分析设计原理与实现
- Maximum area of solar panel od js
- 品牌广告投放平台的中台化应用与实践
- 6、显示评论和回复
- 7. List of private messages
- CentOS7下mysql5.7.37的安装【完美方案】
- What is distributed and clustered?What is the difference?
- The Sad History of Image Processing Technology
- YOLOV5 study notes (2) - environment installation + operation + training
- Chapter 9 SVM Practice
猜你喜欢
![LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING](/img/56/fcc8ee6f592abf0a374fc950a3362f.png)
LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING

【Android】Room —— SQLite的替代品

7. List of private messages

YOLOV5学习笔记(二)——环境安装+运行+训练

What is a distributed lock?Three ways of implementing distributed lock

什么是分布式锁?实现分布式锁的三种方式

软件积累 -- 截图软件ScreenToGif

The simulation application of common mode inductance is here, full of dry goods for everyone

MPPT solar charge controller data collection - through the gateway acquisition capacity battery SOC battery voltage, wi-fi

SQL injection Less54 (limited number of SQL injection + union injection)
随机推荐
LeetCode简单题之两个数组间的距离值
Uninstallation of mysql5.7.37 under CentOS7 [perfect solution]
Hanyuan Hi-Tech 8-channel HDMI integrated multi-service high-definition video optical transceiver 8-channel HDMI video + 8-channel two-way audio + 8-channel 485 data + 8-channel E1 + 32-channel teleph
Live Preview | KDD2022 Doctoral Dissertation Award Champion and Runner-up Dialogue
刚出道“一战成名”,安全、舒适一个不落
CloudCompare&PCL 计算两个点云之间的重叠度
Crypto Firms Offer Offer To Theft Hackers: Keep A Little, Give The Rest
跨专业考研难度大?“上岸”成功率低?这份实用攻略请收下!
你们程序员为什么不靠自己的项目谋生?而必须为其他人打工?
The principle of complete replication of virtual machines (cloud computing)
IIR滤波器和FIR滤波器
10、Redis实现点赞(Set)和获取总点赞数
SQL injection Less47 (error injection) and Less49 (time blind injection)
Mysql 45讲学习笔记(二十五)MYSQL保证高可用
String为什么不可变?
Discourse 自定义头部链接(Custom Header Links)
Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care
The modification is not properly placed in the sandbox, causing Apple compatibility issues
多线程下类对象的服务承诺探讨
Face detection based on opencv