AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
SKILL verified Apache-2.0 Self-run

Java Spring Boot

skill-linlannet-agent-skills-java-spring-boot · by linlannet

Build production Spring Boot applications - REST APIs, Security, Data, Actuator

No reviews yet
0 installs
15 views
0.0% view→install

Install

$ agentstack add skill-linlannet-agent-skills-java-spring-boot

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/skill-linlannet-agent-skills-java-spring-boot)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
6mo ago

Declared compatibility

Claude CodeClaude Desktop

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Java Spring Boot? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

Java Spring Boot 技能

使用现代最佳实践构建生产级 Spring Boot 应用程序。

概述

本技能涵盖 Spring Boot 开发,包括 REST API、安全配置、数据访问、Actuator 监控和云集成。遵循 Spring Boot 3.x 模式,强调生产就绪性。

何时使用此技能

当您需要以下操作时使用:

  • 使用 Spring MVC/WebFlux 创建 REST API
  • 配置 Spring Security(OAuth2、JWT)
  • 使用 Spring Data 设置数据库访问
  • 使用 Actuator 启用监控
  • 与 Spring Cloud 集成

涵盖主题

Spring Boot 核心

  • 自动配置和启动器
  • 应用程序属性和配置文件
  • Bean 生命周期和配置
  • DevTools 和热重载

REST API 开发

  • @RestController 和 @RequestMapping
  • 请求/响应处理
  • 使用 Bean Validation 进行验证
  • 使用 @ControllerAdvice 进行异常处理

Spring Security

  • SecurityFilterChain 配置
  • OAuth2 和 JWT 认证
  • 方法安全(@PreAuthorize)
  • CORS 和 CSRF 配置

Spring Data JPA

  • 仓库模式
  • 查询方法和 @Query
  • 分页和排序
  • 审计和事务

Actuator & 监控

  • 健康检查和探针
  • 使用 Micrometer 的指标
  • 自定义端点
  • Prometheus 集成

快速参考

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

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

    @PostMapping
    public ResponseEntity 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());
    }
}

配置模板

# 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

常见模式

分层架构

Controller → Service → Repository → Database
     ↓           ↓          ↓
   DTOs      Entities    Entities

验证模式

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

故障排除

常见问题

| 问题 | 原因 | 解决方案 | |------|------|----------| | Bean not found | 缺少 @Component | 添加注解或 @Bean | | Circular dependency | 构造函数注入 | 使用 @Lazy 或重构 | | 401 Unauthorized | 安全配置 | 检查 permitAll 路径 | | Slow startup | 繁重的自动配置 | 排除未使用的启动器 |

调试属性

debug=true
logging.level.org.springframework.security=DEBUG
spring.jpa.show-sql=true

调试清单

□ 检查 /actuator/conditions
□ 验证活动配置文件
□ 审查安全过滤器链
□ 检查 Bean 定义
□ 测试健康端点

使用方法

Skill("java-spring-boot")

相关技能

  • java-testing - Spring 测试模式
  • java-jpa-hibernate - 数据访问

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.