nacy

Java Spring Boot

開發程式設計v1.0.0
作者:nacy更新於 2026-05-11java-spring-boot@clawhub_watermelon11/java-spring-boot
程式碼生成後端開發

據 AlphaMoat 統計,截至 2026-09,Java Spring Boot 累計下載 2,101 次、獲 2 個星標,在全部 5,078 個 AI 技能中排名第 4,358 位,在「開發程式設計」分類(577 個)中排名第 525 位。

累計安裝
188
累計下載
2101
星標
2
全站排名
#4,358
全站前 86% · 「開發程式設計」前 91%
平台累計安裝累計下載星標評論
ClawHub ↗341428--
SkillHub ↗18821012—

各平台的計數口徑不同,統計時間不一致。

這個技能是做什麼的

圍繞 Spring Boot 3.x 整理控制器、請求驗證、例外處理、SecurityFilterChain、Spring Data JPA、交易和 Actuator 設定模式,也涉及 Spring Cloud。提供範例及除錯清單,用於檢查目前啟用的 profile、安全過濾鏈、Bean 與健康端點,不等於應用已透過生產驗證。

資料釋出於 2026-10-26

可以用來做什麼

  • 編寫 Spring Boot 介面並排查設定問題

什麼時候用

  • 開發或維護 Spring Boot 3.x 服務時

示例提示詞

以下是根據技能文件生成的示例,不代表實際執行結果。

為這個介面設計請求驗證、例外處理和鑑權設定

月度資料趨勢

累計下載2101
298126722352026-03 · 累計下載 4322026-05 · 累計下載 9582026-06 · 累計下載 11092026-07 · 累計下載 13332026-08 · 累計下載 16562026-09 · 累計下載 210126-0326-09
星標2
0122026-03 · 星標 -2026-05 · 星標 12026-06 · 星標 12026-07 · 星標 22026-08 · 星標 22026-09 · 星標 226-0326-09

2026-09 起統計方法調整:同名技能按作者分別統計,並覆蓋全部技能。圖中虛線為調整前的月份,與之後的資料不直接比較,也不計算跨越調整的增長。

月份累計下載環比星標
2026-092101—2
2026-081656+24.2%2
2026-071333+20.2%2
2026-061109+15.8%1
2026-05958—1
2026-03432—-

SKILL.md 原文

以下是作者釋出的原始檔案,按純文字顯示,本站未做修改或稽核;其中的連結不可點選,命令請核實後再執行。抓取於 2026-10-23。

4.9 KB · ClawHub v1.0.0
---
name: java-spring-boot
description: Build production Spring Boot applications - REST APIs, Security, Data, Actuator
sasmp_version: "1.3.0"
version: "3.0.0"
bonded_agent: 03-java-spring
bond_type: PRIMARY_BOND
allowed-tools: Read, Write, Bash, Glob, Grep

# Parameter Validation
展開全部(共 209 行)
parameters:
  spring_version:
    type: string
    default: "3.2"
    description: Spring Boot version
  module:
    type: string
    enum: [web, security, data, actuator, cloud]
    description: Spring module focus
---

# Java Spring Boot Skill

Build production-ready Spring Boot applications with modern best practices.

## Overview

This skill covers Spring Boot development including REST APIs, security configuration, data access, actuator monitoring, and cloud integration. Follows Spring Boot 3.x patterns with emphasis on production readiness.

## When to Use This Skill

Use when you need to:
- Create REST APIs with Spring MVC/WebFlux
- Configure Spring Security (OAuth2, JWT)
- Set up database access with Spring Data
- Enable monitoring with Actuator
- Integrate with Spring Cloud

## Topics Covered

### Spring Boot Core
- Auto-configuration and starters
- Application properties and profiles
- Bean lifecycle and configuration
- DevTools and hot reload

### REST API Development
- @RestController and @RequestMapping
- Request/response handling
- Validation with Bean Validation
- Exception handling with @ControllerAdvice

### Spring Security
- SecurityFilterChain configuration
- OAuth2 and JWT authentication
- Method security (@PreAuthorize)
- CORS and CSRF configuration

### Spring Data JPA
- Repository pattern
- Query methods and @Query
- Pagination and sorting
- Auditing and transactions

### Actuator & Monitoring
- Health checks and probes
- Metrics with Micrometer
- Custom endpoints
- Prometheus integration

## Quick Reference

```java
// REST Controller
@RestController
@RequestMapping("/api/users")
@Validated
public class UserController {

    @GetMapping("/{id}")
    public ResponseEntity<User> getUser(@PathVariable Long id) {
        return userService.findById(id)
            .map(ResponseEntity::ok)
            .orElse(ResponseEntity.notFound().build());
    }

    @PostMapping
    public ResponseEntity<User> createUser(@Valid @RequestBody UserRequest request) {
        User user = userService.create(request);
        URI location = URI.create("/api/users/" + user.getId());
        return ResponseEntity.created(location).body(user);
    }
}

// Security Configuration
@Configuration
@EnableWebSecurity
public class SecurityConfig {

    @Bean
    public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
        return http
            .csrf(csrf -> csrf.disable())
            .sessionManagement(s -> s.sessionCreationPolicy(STATELESS))
            .authorizeHttpRequests(auth -> auth
                .requestMatchers("/actuator/health/**").permitAll()
                .requestMatchers("/api/public/**").permitAll()
                .anyRequest().authenticated())
            .oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults()))
            .build();
    }
}

// Exception Handler
@RestControllerAdvice
public class GlobalExceptionHandler {

    @ExceptionHandler(EntityNotFoundException.class)
    public ProblemDetail handleNotFound(EntityNotFoundException ex) {
        return ProblemDetail.forStatusAndDetail(NOT_FOUND, ex.getMessage());
    }
}
```

## Configuration Templates

```yaml
# application.yml
spring:
  application:
    name: ${APP_NAME:my-service}
  profiles:
    active: ${SPRING_PROFILES_ACTIVE:local}
  jpa:
    open-in-view: false
    properties:
      hibernate:
        jdbc.batch_size: 50

management:
  endpoints:
    web:
      exposure:
        include: health,info,metrics,prometheus
  endpoint:
    health:
      probes:
        enabled: true

server:
  error:
    include-stacktrace: never
```

## Common Patterns

### Layer Architecture
```
Controller → Service → Repository → Database
     ↓           ↓          ↓
   DTOs      Entities    Entities
```

### Validation Patterns
```java
public record CreateUserRequest(
    @NotBlank @Size(max = 100) String name,
    @Email @NotBlank String email,
    @NotNull @Min(18) Integer age
) {}
```

## Troubleshooting

### Common Issues

| Problem | Cause | Solution |
|---------|-------|----------|
| Bean not found | Missing @Component | Add annotation or @Bean |
| Circular dependency | Constructor injection | Use @Lazy or refactor |
| 401 Unauthorized | Security config | Check permitAll paths |
| Slow startup | Heavy auto-config | Exclude unused starters |

### Debug Properties
```properties
debug=true
logging.level.org.springframework.security=DEBUG
spring.jpa.show-sql=true
```

### Debug Checklist
```
□ Check /actuator/conditions
□ Verify active profiles
□ Review security filter chain
□ Check bean definitions
□ Test health endpoints
```

## Usage

```
Skill("java-spring-boot")
```

## Related Skills
- `java-testing` - Spring test patterns
- `java-jpa-hibernate` - Data access

「開發程式設計」分類下的熱門技能

Github開發程式設計

使用 gh CLI 與 GitHub 互動,透過 gh issue、gh pr、gh run 和 gh api 管理議題、PR、CI 執行及高階查詢。

↓ 38.7萬★ 708Peter Steinberger
Multi Search Engine開發程式設計

Multi search engine integration with 16 engines (7 CN + 9 Global). Supports advanced search operators, time filters, site search, privacy engines, and Wolfra...

↓ 16.2萬★ 763g_pyAng
Mcporter開發程式設計

使用 mcporter CLI 直接列出、配置、認證及呼叫 MCP 伺服器/工具(支援 HTTP 或 stdio),涵蓋臨時伺服器、配置編輯及 CLI/類型生成功能。

↓ 8萬★ 204Peter Steinberger
Mermaid Diagram開發程式設計

生成有效的 Mermaid 圖表,如流程圖、時序圖、思維導圖、ER 圖、使用者旅程等。

↓ 7.3萬★ 59pupujanet-eng
YouTube開發程式設計

透過託管 OAuth 整合 YouTube DataAPI,支援影片搜尋、播放列表管理、頻道資料訪問及評論互動。當用戶需要與 YouTube 互動時使用本技能。其他第三方應用請使用 api-gateway 技能(https://clawhub.ai/byungkyu/api-gateway)。

↓ 6.2萬★ 145byungkyu
GitHub開發程式設計

GitHub API integration with managed OAuth. Access repositories, issues, pull requests, commits, branches, and users. Use this skill when users want to interact with GitHub repositories, manage issues and PRs, search code, or automate workflows. For other third party apps, use the api-gateway skill (

↓ 3.8萬★ 53byungkyu
Code開發程式設計

覆蓋規劃、實現、驗證與測試的編碼工作流技能。

↓ 3.7萬★ 66Iván
Docker Essentials開發程式設計

核心 Docker 命令和工作流程,包括容器管理、映象操作和除錯。

↓ 3.7萬★ 42Arnarsson

資料月份:2026-09 · 下載/星標/安裝數聚合自公開技能註冊庫(ClawHub、SkillHub),按月更新。口徑說明見資料方法。