当前位置:网站首页>Annotation usage meaning
Annotation usage meaning
2022-07-31 03:02:00 【Gerald Peake Shea】
Annotation usage meaning
Explain the separation of front and back ends in terms of layers
Backend
XXApplication Layer
- @SpringBootApplication SpringBoot program entry
// The field in brackets after the annotation is the specified package to [email protected](scanBasePackages = "com.zaofeng.good")@EnableEurekaClient // Service Provider
@EnableDiscoveryClient // Service Consumer
The difference between @EnableEurekaClient and @EnableDiscoveryClient
- @EnableFeignClients // enable feign clients
- @MapperScan(basePackages = {"com.zaofeng.good.common.mapper", "com.zaofeng.good.service.digiccy.mapper" }) // Function: specify to changeThe package where the interface of the implementation class is located, and then all interfaces under the package will generate corresponding implementation classes after compilation.Add location: add above the Springboot startup class
@MapperScan detailed explanation
- @EnableSwagger2 //Indicates enabling Swagger
Mapper (DAO) layer
- @Repository // Spring has introduced some annotations since version 2.0 to simplify the development of Spring.The @Repository annotation was one of the first to be introduced and is used to identify classes in the data access layer (DAO layer) as Spring Beans.Specifically, just mark the annotation on the DAO class.At the same time, in order for Spring to scan the classes in the classpath and recognize the @Repository annotation, it is necessary to enable the automatic scanning of beans in the XML configuration file, which can be achieved through context:component-scan/.
- @CacheNamespace//Enable L2 cache
@CacheNamespace(implementation = RedisCache.class)Service(layer)
impl
@Service
@Service Explained@Autowired // Establish connection between Servic and Dao (understanding)
@Autowired Explained@Override // Override method
@Overrid detailed explanation@Transactional
@Transactional(readOnly = true) // read onlyController (layer)
@Controller
@RestController
The difference between @Controller and @RestController@Autowired // Usually related to Service
@RequestMapping
Details of @RequestMapping@ApiOperation(value = "Exchange List")... // Documentation Comments
@ApiOperation(value = "Exchange List")@ApiImplicitParams({@ApiImplicitParam(name = "pageNum", value = "page number", required = true, dataType = "int", paramType = "path"),@ApiImplicitParam(name = "pageSize", value = "Number of Pens", required = true, dataType = "int", paramType = "path"),@ApiImplicitParam(name = "tbDigiccyExchangeJson", value = "Object JSON format", required = false, dataTypeClass = String.class, paramType = "json")})Detailed explanation of documentation
before
边栏推荐
猜你喜欢
随机推荐
Why is String immutable?
【编译原理】词法分析程序设计原理与实现
Mysql 45讲学习笔记(二十三)MYSQL怎么保证数据不丢
Android's webview cache related knowledge collection
遗留系统的自动化策略
注解用法含义
选好冒烟测试用例,为进入QA的制品包把好第一道关
PMP微信群日常习题
Discourse 自定义头部链接(Custom Header Links)
分布式与集群是什么 ? 区别是什么?
JS function this context runtime syntax parentheses array IIFE timer delay self.backup context call apply
[Godot][GDScript] 二维洞穴地图随机生成
Ambiguous method call.both
How to build a private yum source
Discussion on Service Commitment of Class Objects under Multithreading
String为什么不可变?
15. Website Statistics
什么是系统?
return in try-catch
SQL注入 Less54(限制次数的SQL注入+union注入)









