spring-boot
Master Spring Boot development with comprehensive guidance covering RESTful API design, application architecture, and production deployment. Learn proper use of Spring annotations, dependency injection, configuration management, and security patterns. This skill covers testing strategies, performance optimization, monitoring with Actuator, and containerization for modern Java applications.
Spring Boot helps you build production-ready REST APIs with expert guidance on security, testing, and deployment best practices.
AI-generated summary based on this skill's SKILL.md
Install
Mindrally/skills/spring-boot
git clone https://github.com/Mindrally/skills
cp -r skills/spring-boot ~/.claude/skills/spring-bootnpx skillfed install Mindrally/skills/spring-bootFrequently asked questions
AI-generated answers based on this skill's SKILL.md and metadata
How to build REST APIs with spring boot?
Spring Boot simplifies REST API development through embedded servers, auto-configuration, and starter dependencies. Create controllers using @RestController and @RequestMapping annotations, define service layers with @Service, and leverage Spring Data JPA for database operations. Spring Boot handles HTTP request routing, serialization, and response formatting automatically. Use @GetMapping, @PostMapping, @PutMapping, and @DeleteMapping for CRUD operations. Implement proper error handling with @ExceptionHandler and @ControllerAdvice for consistent API responses across your application.
What are spring boot best practices for production?
Spring Boot production readiness requires externalized configuration via application.properties or YAML files, environment-specific profiles, and secrets management. Implement comprehensive logging with SLF4J, use Spring Boot Actuator for health checks and metrics, and enable security with Spring Security. Apply proper exception handling, input validation, and API documentation using Swagger/OpenAPI. Monitor performance, implement caching strategies, and containerize applications with Docker. Use dependency injection effectively, follow SOLID principles, and maintain separation of concerns between controllers, services, and repositories.
How does spring boot testing with junit work?
Spring Boot testing combines JUnit with Spring's testing framework through @SpringBootTest annotation for integration tests and @WebMvcTest for controller testing. Use MockMvc to test REST endpoints without starting a full server, and @MockBean to mock dependencies. Unit tests leverage standard JUnit assertions and Mockito for isolation. Spring Boot provides TestRestTemplate for testing HTTP interactions. Write integration tests with embedded databases like H2, and use @DataJpaTest for repository testing. Organize tests in src/test/java following the same package structure as production code.
What is spring boot microservices architecture?
Spring Boot microservices architecture decomposes applications into independent, loosely-coupled services communicating via REST or messaging. Each service has its own database, configuration, and deployment lifecycle. Spring Boot enables rapid service development with minimal boilerplate. Implement service discovery, load balancing, and inter-service communication patterns. Use Spring Cloud for distributed configuration, circuit breakers, and API gateways. Deploy services in containers for scalability. Establish clear API contracts, implement proper logging and tracing across services, and monitor each service independently using Spring Boot Actuator.
How to configure spring boot for different environments?
Spring Boot supports environment-specific configuration through profiles and externalized properties. Create application-{profile}.properties files for development, staging, and production environments. Activate profiles via spring.profiles.active property or environment variables. Use @Profile annotation to conditionally load beans. Externalize sensitive data like database credentials and API keys using environment variables or dedicated secret management tools. Spring Boot Actuator provides environment endpoint to inspect active configuration. Implement feature flags for gradual rollouts and use ConfigurationProperties for type-safe configuration binding with validation.
What monitoring capabilities does spring boot actuator provide?
Spring Boot Actuator exposes production-ready endpoints for application monitoring and management. Built-in endpoints include /health for application status, /metrics for performance metrics, /env for environment properties, and /loggers for runtime log level adjustment. Integrate with monitoring tools like Prometheus and Grafana for visualization. Actuator provides custom metrics registration, HTTP trace information, and thread dump capabilities. Configure endpoint exposure via management.endpoints.web.include property. Use health indicators to monitor database connectivity, disk space, and custom application states. Implement proper security to restrict Actuator endpoint access in production environments.
SKILL.md
rendered from the published skill — quoted content, verbatim
Spring Boot
You are an expert in Java programming, Spring Boot, Spring Framework, Maven, JUnit, and related Java technologies.
Code Style and Structure
- Write clean, efficient, and well-documented Java code using Spring Boot conventions
- Follow RESTful API design patterns for web services
- Use descriptive method and variable names following camelCase convention
- Structure applications with consistent package organization (controllers, services, repositories, models, configurations)
Spring Boot Specifics
- Leverage Spring Boot starters for rapid application development
- Use auto-configuration effectively to minimize boilerplate
- Implement proper annotations (@SpringBootApplication, @RestController, @Service, @Repository)
- Handle exceptions globally via @ControllerAdvice and @ExceptionHandler
Naming Conventions
- Use PascalCase for class names (e.g., UserController, OrderService)
- Use camelCase for method and variable names (e.g., findUserById, isOrderValid)
- Use ALL_CAPS for constants
(truncated - see the full file via the links below)
Read as markdown · JSON record · Browse the source repository
File tree — 1 file
spring-boot/SKILL.md