当前位置:网站首页>注解用法含义
注解用法含义
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")
})
前
边栏推荐
- LeetCode 每日一题 2022/7/25-2022/7/31
- Office automation case: how to automatically generate period data?
- BAT can't sell "Medical Cloud": Hospitals flee, mountains stand, and there are rules
- 10、Redis实现点赞(Set)和获取总点赞数
- Refuse to work overtime, a productivity tool set developed by programmers
- mycat的主从关系 垂直分库 水平分表 以及mycat分片联表查询的配置详解(mysql5.7系列)
- 15、网站统计数据
- VS QT——ui不显示新添加成员(控件)||代码无提示
- Difference between CMOS and TTL?
- 【CV项目调试】CUDNN_CONVOLUTION_FWD_SPECIFY_WORKSPACE_LIMIT问题
猜你喜欢
f.grid_sample
【C语言】三子棋(经典解法+一览图)
MPPT solar charge controller data collection - through the gateway acquisition capacity battery SOC battery voltage, wi-fi
C#远程调试
What is distributed and clustered?What is the difference?
华为分布式存储FusionStorage知识点总结【面试篇】
The simulation application of common mode inductance is here, full of dry goods for everyone
19.支持向量机-优化目标和大间距直观理解
刚出道“一战成名”,安全、舒适一个不落
Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
随机推荐
多线程下类对象的服务承诺探讨
[Godot][GDScript] 二维洞穴地图随机生成
LeetCode中等题之分数加减运算
SQL注入 Less54(限制次数的SQL注入+union注入)
SQL注入 Less47(报错注入) 和Less49(时间盲注)
Chapter 9 SVM实践
The application of AI in the whole process of medical imaging equipment
Graphical lower_bound & upper_bound
SQL注入 Less46(order by后的注入+rand()布尔盲注)
【C语言】三子棋(经典解法+一览图)
AI software development process in medical imaging field
LeetCode Daily Question 2022/7/25-2022/7/31
公司官网建站笔记(六):域名进行公安备案并将备案号显示在网页底部
Multilingual settings of php website (IP address distinguishes domestic and foreign)
JetPack component Databinding
11、Redis实现关注、取消关注以及关注和粉丝列表
什么是系统?
刚出道“一战成名”,安全、舒适一个不落
12 磁盘相关命令
原子操作 CAS