java-spring-boot by pluginagentmarketplace/custom-plugin-java
npx skills add https://github.com/pluginagentmarketplace/custom-plugin-java --skill java-spring-boot使用现代最佳实践构建生产就绪的 Spring Boot 应用程序。
本技能涵盖 Spring Boot 开发,包括 REST API、安全配置、数据访问、Actuator 监控和云集成。遵循 Spring Boot 3.x 模式,重点关注生产就绪性。
在需要以下功能时使用:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
// 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());
}
}
# 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 未找到 | 缺少 @Component | 添加注解或 @Bean |
| 循环依赖 | 构造函数注入 | 使用 @Lazy 或重构 |
| 401 未授权 | 安全配置 | 检查 permitAll 路径 |
| 启动缓慢 | 繁重的自动配置 | 排除未使用的启动器 |
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 - 数据访问每周安装量
4.9K
仓库
GitHub 星标数
27
首次出现
Jan 21, 2026
安全审计
安装于
claude-code3.8K
opencode1.7K
gemini-cli1.6K
codex1.6K
github-copilot1.5K
kimi-cli1.3K
Build production-ready Spring Boot applications with modern best practices.
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.
Use when you need to:
// 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());
}
}
# 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
) {}
| 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=true
logging.level.org.springframework.security=DEBUG
spring.jpa.show-sql=true
□ Check /actuator/conditions
□ Verify active profiles
□ Review security filter chain
□ Check bean definitions
□ Test health endpoints
Skill("java-spring-boot")
java-testing - Spring test patternsjava-jpa-hibernate - Data accessWeekly Installs
4.9K
Repository
GitHub Stars
27
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
claude-code3.8K
opencode1.7K
gemini-cli1.6K
codex1.6K
github-copilot1.5K
kimi-cli1.3K
React 组合模式指南:Vercel 组件架构最佳实践,提升代码可维护性
102,200 周安装