spring-boot
Spring Boot 3+ expert for building enterprise Java applications. Covers REST APIs, security, data access, and microservices patterns.
来源信息
- 仓库
- skeletorflet/opencode-kit
- 最近来源活动
- 2026年3月31日 18:16
- 检测到的 SKILL.md 语言
- 英语
- 星标
- 9
- Forks
- 1
安装方式
默认使用会先检查来源的 Prompt;你也可以切换为直接命令,或下载本地副本。
检查来源文件
决定是否安装前,请先阅读 SKILL.md,以及 SkillsMP 当前展示的配套文件。
正在显示 SKILL.md
SKILL.md
来源说明 · 只读预览- name
- spring-boot
- description
- Spring Boot 3+ expert for building enterprise Java applications. Covers REST APIs, security, data access, and microservices patterns.
- license
- MIT
- compatibility
- opencode
- metadata
- {"audience":"developers","category":"backend"}
# Spring Boot Expert
## What I Do
- Build REST APIs with Spring Web and Spring Data
- Configure Spring Security for authentication and authorization
- Implement reactive programming with WebFlux
- Set up Spring Data JPA with proper entity design
- Configure microservices with Spring Cloud
## When to Use Me
- Creating Spring Boot applications
- Designing RESTful APIs
- Implementing security with Spring Security
- Setting up database access with Spring Data
- Building microservices architectures
## Key Principles
1. **Constructor Injection**: Always prefer constructor over field injection
2. **DTO Pattern**: Never expose entities directly in API responses
3. **Exception Handling**: Use @ControllerAdvice for centralized error handling
4. **Validation**: Use Bean Validation (@Valid) at API boundaries
5. **Profiles**: Use application profiles for environment-specific config
## Common Patterns
### REST Controller
```java
@RestController
@RequestMapping("/api/users")
@RequiredArgsConstructor
public class UserController {
private final UserService userService;
@GetMapping("/{id}")
public ResponseEntity<UserDto> getUser(@PathVariable Long id) {
return userService.findById(id)
.map(ResponseEntity::ok)
.orElse(ResponseEntity.notFound().build());
}
@PostMapping
@ResponseStatus(HttpStatus.CREATED)
public UserDto createUser(@Valid @RequestBody CreateUserRequest request) {
return userService.create(request);
}
}
```
### Global Exception Handler
```java
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(EntityNotFoundException.class)
public ResponseEntity<ErrorResponse> handleNotFound(EntityNotFoundException ex) {
return ResponseEntity.status(HttpStatus.NOT_FOUND)
.body(new ErrorResponse(ex.getMessage()));
}
}
```
## Validation
```bash
./mvnw test
./mvnw spring-boot:run
```
在 GitHub 查看