Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Build production-ready Spring Boot 3.x applications with REST APIs, Security, Data JPA, and Actuator
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: java-spring-boot3description: Build production Spring Boot applications - REST APIs, Security, Data, Actuator4sasmp_version: "1.3.0"5version: "3.0.0"6bonded_agent: 03-java-spring7bond_type: PRIMARY_BOND8allowed-tools: Read, Write, Bash, Glob, Grep910# Parameter Validation11parameters:12spring_version:13type: string14default: "3.2"15description: Spring Boot version16module:17type: string18enum: [web, security, data, actuator, cloud]19description: Spring module focus20---2122# Java Spring Boot Skill2324Build production-ready Spring Boot applications with modern best practices.2526## Overview2728This 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.2930## When to Use This Skill3132Use when you need to:33- Create REST APIs with Spring MVC/WebFlux34- Configure Spring Security (OAuth2, JWT)35- Set up database access with Spring Data36- Enable monitoring with Actuator37- Integrate with Spring Cloud3839## Topics Covered4041### Spring Boot Core42- Auto-configuration and starters43- Application properties and profiles44- Bean lifecycle and configuration45- DevTools and hot reload4647### REST API Development48- @RestController and @RequestMapping49- Request/response handling50- Validation with Bean Validation51- Exception handling with @ControllerAdvice5253### Spring Security54- SecurityFilterChain configuration55- OAuth2 and JWT authentication56- Method security (@PreAuthorize)57- CORS and CSRF configuration5859### Spring Data JPA60- Repository pattern61- Query methods and @Query62- Pagination and sorting63- Auditing and transactions6465### Actuator & Monitoring66- Health checks and probes67- Metrics with Micrometer68- Custom endpoints69- Prometheus integration7071## Quick Reference7273```java74// REST Controller75@RestController76@RequestMapping("/api/users")77@Validated78public class UserController {7980@GetMapping("/{id}")81public ResponseEntity<User> getUser(@PathVariable Long id) {82return userService.findById(id)83.map(ResponseEntity::ok)84.orElse(ResponseEntity.notFound().build());85}8687@PostMapping88public ResponseEntity<User> createUser(@Valid @RequestBody UserRequest request) {89User user = userService.create(request);90URI location = URI.create("/api/users/" + user.getId());91return ResponseEntity.created(location).body(user);92}93}9495// Security Configuration96@Configuration97@EnableWebSecurity98public class SecurityConfig {99100@Bean101public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {102return http103.csrf(csrf -> csrf.disable())104.sessionManagement(s -> s.sessionCreationPolicy(STATELESS))105.authorizeHttpRequests(auth -> auth106.requestMatchers("/actuator/health/**").permitAll()107.requestMatchers("/api/public/**").permitAll()108.anyRequest().authenticated())109.oauth2ResourceServer(oauth2 -> oauth2.jwt(Customizer.withDefaults()))110.build();111}112}113114// Exception Handler115@RestControllerAdvice116public class GlobalExceptionHandler {117118@ExceptionHandler(EntityNotFoundException.class)119public ProblemDetail handleNotFound(EntityNotFoundException ex) {120return ProblemDetail.forStatusAndDetail(NOT_FOUND, ex.getMessage());121}122}123```124125## Configuration Templates126127```yaml128# application.yml129spring:130application:131name: ${APP_NAME:my-service}132profiles:133active: ${SPRING_PROFILES_ACTIVE:local}134jpa:135open-in-view: false136properties:137hibernate:138jdbc.batch_size: 50139140management:141endpoints:142web:143exposure:144include: health,info,metrics,prometheus145endpoint:146health:147probes:148enabled: true149150server:151error:152include-stacktrace: never153```154155## Common Patterns156157### Layer Architecture158```159Controller → Service → Repository → Database160↓ ↓ ↓161DTOs Entities Entities162```163164### Validation Patterns165```java166public record CreateUserRequest(167@NotBlank @Size(max = 100) String name,168@Email @NotBlank String email,169@NotNull @Min(18) Integer age170) {}171```172173## Troubleshooting174175### Common Issues176177| Problem | Cause | Solution |178|---------|-------|----------|179| Bean not found | Missing @Component | Add annotation or @Bean |180| Circular dependency | Constructor injection | Use @Lazy or refactor |181| 401 Unauthorized | Security config | Check permitAll paths |182| Slow startup | Heavy auto-config | Exclude unused starters |183184### Debug Properties185```properties186debug=true187logging.level.org.springframework.security=DEBUG188spring.jpa.show-sql=true189```190191### Debug Checklist192```193□ Check /actuator/conditions194□ Verify active profiles195□ Review security filter chain196□ Check bean definitions197□ Test health endpoints198```199200## Usage201202```203Skill("java-spring-boot")204```205206## Related Skills207- `java-testing` - Spring test patterns208- `java-jpa-hibernate` - Data access209