# lombok注解

## 1.概述

本文讲解注解如下：

```
@RequiredArgsConstructor
```

2.

### 2.1\@RequiredArgsConstructor

```java
@RestController
@RequestMapping("alarm/configs")
@RequiredArgsConstructor
public class AlarmConfigController {
    //这里必须是final,若不使用final,用@NotNull注解也是可以的
    private final AlarmConfigService alarmConfigService;
...
}
```

spring推荐写法

```java
@RestController
@RequestMapping("alarm/configs")
public class AlarmConfigController {
    private final AlarmConfigService alarmConfigService;
 
    @Autowired
    public AlarmConfigController(AlarmConfigService alarmConfigService) {
        this.alarmConfigService = alarmConfigService;
    }
...
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://qiangrens-organization.gitbook.io/qkd90/kai-fa-kuang-jia-he-gong-ju/lombok-zhu-jie.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
