Scaffold Spring Boot application with REST API
✓Works with OpenClaudeYou are a Java developer setting up a new Spring Boot REST API project. The user wants to scaffold a production-ready Spring Boot application with REST endpoints, database integration, and proper project structure.
What to check first
- Verify Java 17+ is installed:
java -version - Confirm Maven 3.8+ is available:
mvn -version - Check if Spring Boot CLI is installed (optional):
spring --version
Steps
- Create a new Spring Boot project using Spring Initializr with Maven:
curl https://start.spring.io/starter.zip -d dependencies=web,data-jpa,h2,validation -d language=java -d javaVersion=17 -d name=api-service -o api-service.zip && unzip api-service.zip - Extract the project and navigate to the directory:
cd api-service - Verify
pom.xmlcontainsspring-boot-starter-web,spring-boot-starter-data-jpa, andh2databasedependencies - Create the entity model in
src/main/java/com/example/apiservice/model/User.javawith@Entityand@Idannotations - Create a repository interface extending
JpaRepositoryinsrc/main/java/com/example/apiservice/repository/UserRepository.java - Create a REST controller in
src/main/java/com/example/apiservice/controller/UserController.javawith@RestControllerand@RequestMappingannotations - Configure
application.propertieswith datasource and JPA settings for H2 in-memory database - Run the application:
mvn spring-boot:runand verify it starts on port 8080
Code
// src/main/java/com/example/apiservice/model/User.java
package com.example.apiservice.model;
import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@NotBlank(message = "Name is required")
@Column(nullable = false)
private String name;
@Email(message = "Email should be valid")
@Column(unique = true, nullable = false)
private String email;
public User() {}
public User(String name, String email) {
this.name = name;
this.email = email;
}
public Long getId() { return id; }
public void setId(Long id) { this.id = id; }
public String getName() { return name; }
public void setName(String name) { this.name = name; }
public String getEmail() { return email; }
public void setEmail(String email)
Note: this example was truncated in the source. See the GitHub repo for the latest full version.
Common Pitfalls
- Treating this skill as a one-shot solution — most workflows need iteration and verification
- Skipping the verification steps — you don't know it worked until you measure
- Applying this skill without understanding the underlying problem — read the related docs first
When NOT to Use This Skill
- When a simpler manual approach would take less than 10 minutes
- On critical production systems without testing in staging first
- When you don't have permission or authorization to make these changes
How to Verify It Worked
- Run the verification steps documented above
- Compare the output against your expected baseline
- Check logs for any warnings or errors — silent failures are the worst kind
Production Considerations
- Test in staging before deploying to production
- Have a rollback plan — every change should be reversible
- Monitor the affected systems for at least 24 hours after the change
Related Java Skills
Other Claude Code skills in the same category — free to download.
Java Testing
Set up JUnit 5 with Mockito and test containers
Maven/Gradle
Configure Maven or Gradle build system for Java projects
Spring Security
Configure Spring Security with JWT and OAuth2
Spring Data JPA
Set up Spring Data JPA with repositories and entities
Java Streams
Refactor loops to Java Streams and functional patterns
Java Docker
Create optimized Docker image for Java/Spring Boot apps
Java Virtual Threads (Project Loom)
Use Java 21+ virtual threads for high-concurrency I/O without the platform-thread overhead
Java Records and Pattern Matching
Use Java 21+ records and pattern matching for cleaner data classes
Want a Java skill personalized to YOUR project?
This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.