# Re:0 - Starting Life in Backend - Week1
seal
他不懂你的心 假裝冷靜
他不懂愛情 把它當遊戲
他不懂表明相愛這件事
除了對不起就只剩嘆息
@EnableDiscoveryClient
Microservice
@EnableFeignClients
Open Feign search
Swagger Annotations Comparison (Swagger2 vs Swagger3)
Class-Level Annotations
Purpose | Swagger2 (Legacy) | Swagger3 (Current) | Scope |
---|---|---|---|
API Grouping | @Api |
@Tag |
Class, Interface |
Hide API | @ApiIgnore |
@Hidden |
Class, Method |
Method-Level Annotations
Purpose | Swagger2 (Legacy) | Swagger3 (Current) | Scope |
---|---|---|---|
API Description | @ApiOperation |
@Operation |
Method |
Response Codes | @ApiResponses /@ApiResponse |
@ApiResponses /@ApiResponse |
Method |
Parameter-Level Annotations
Purpose | Swagger2 (Legacy) | Swagger3 (Current) | Scope |
---|---|---|---|
Parameter Description | @ApiParam |
@Parameter |
Method Parameter |
Request Body Description | @ApiModelProperty |
@Schema |
Method Parameter, Field |
Model Annotations
Purpose | Swagger2 (Legacy) | Swagger3 (Current) | Scope |
---|---|---|---|
Model Property | @ApiModelProperty |
@Schema |
Field |
Model Description | @ApiModel |
@Schema |
Class |
Security Annotations
Purpose | Swagger2 (Legacy) | Swagger3 (Current) | Scope |
---|---|---|---|
Security Scheme | No direct equivalent | @SecurityScheme |
Configuration Class |
API Security Requirement | No direct equivalent | @SecurityRequirement |
Class, Method |
@CookieValue same as @Requestparam
//inner need to use `value = NotAuthenticated.COOKIE_NAME_FOR_TMOC.key
Mybatis-generator can easily create db search file
Use public @interface
can help to define an annotation
Lombok
@Getter/@Setter/@ToString use these annotations can easily create get Method and set Method;Also tostring
@Data can create all things above
And use @NoArgsConstructor and @ AllArgsConstructor can create constructor classes
Enum is a special class used to define a series of enumeration constants.
Public enum user {
John(0),
Marry(1),
Jack(2);
private final int userId;
private user(int userId) {
this,userId = userId;
}
//here can add a series of functions to expand business capabilities.
}
In @interface realization, we can use default after functions, to set initial value
Public @interface test {
String value() default “”;
}
Feign
AOP
I think it is a hook mechanism, while using AOP, you can simply insert an additional code without changing the source code.
To use AOP, the first step is to use the @Aspect annotation to treat the current class as an AOP aspect; then call annotations such as @Around, declare the injection point in the annotation, and hook it; after the hook is completed, you can use this code to return to the original process Object proceed = pjp.proceed();
Label Classification Aggregation
AggregationBuilders.terms("label"): tells the system: "I want to do a 'classification statistics', counting things called label!"
.field("labels"): specifies the classification of the content in the labels field. For example, if your fault has labels such as "network", "hardware", and "software", it will count these labels.
.size(10): means only the 10 most common labels are counted.
queryBuilder.addAggregation(...): also add the "statistics" requirement to the "menu book".