当前位置:网站首页>注解用法含义
注解用法含义
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")
})
前
边栏推荐
猜你喜欢

Moxa NPort device flaw could expose critical infrastructure to devastating attack

19. Support Vector Machines - Intuitive Understanding of Optimization Objectives and Large Spacing

软件积累 -- 截图软件ScreenToGif

STM32问题合集
![Installation of mysql5.7.37 under CentOS7 [perfect solution]](/img/ef/a89d8bfd09377dc30034bad99dfd07.png)
Installation of mysql5.7.37 under CentOS7 [perfect solution]

Basic learning about Redis related content

Graphical lower_bound & upper_bound

SQL injection Less46 (injection after order by + rand() Boolean blind injection)

6. Display comments and replies

Face detection based on opencv
随机推荐
Clustering index, and what is the difference between a clustering index
CentOS7下mysql5.7.37的安装【完美方案】
mycat的主从关系 垂直分库 水平分表 以及mycat分片联表查询的配置详解(mysql5.7系列)
Why is String immutable?
execsnoop 工具
11. Redis implements follow, unfollow, and follow and follower lists
The application of AI in the whole process of medical imaging equipment
经典链表OJ强训题——快慢双指针高效解法
How to build a private yum source
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
Intel's software and hardware optimization empowers Neusoft to accelerate the arrival of the era of smart medical care
局域网电脑硬件信息收集工具
Chapter 9 SVM实践
IIR滤波器和FIR滤波器
【shell基础】判断目录是否为空
图解lower_bound&upper_bound
YOLOV5学习笔记(三)——网络模块详解
LeetCode 1161 The largest element in the layer and the LeetCode road of [BFS binary tree] HERODING
Pythagorean tuple od js
YOLOV5学习笔记(二)——环境安装+运行+训练