Prerequisites
- Java 17 or later (21 recommended)
- Spring Boot 3.x
- Maven or Gradle
Step 1: Add the dependency
Maven
pom.xml
<dependency>
<groupId>net.rspond</groupId>
<artifactId>rspond-spring-boot-starter</artifactId>
<version>0.1.0</version>
</dependency>
Gradle
build.gradle
implementation 'net.rspond:rspond-spring-boot-starter:0.1.0'
Step 2: Use a status handler
Implement StatusApiTraits in any Spring @Service or @Component to get access to structured error handling:
UserService.java
@Service
public class UserService implements StatusApiTraits {
public User findById(String id) {
var captured = statusList();
var user = captured.tryCatch(
() -> repository.find(id),
"user.lookup failed for: " + id);
return captured.hasNoErrors() ? user : null;
}
}
The statusList() method creates a handler that collects errors as structured statuses. Use tryCatch() to capture exceptions, or pass the handler to RSpond converters for type-safe conversions with automatic error reporting. All errors are collected—not just the first one.
Step 3: Run and observe
Start your Spring Boot application normally. RSpond auto-configures alongside Spring Boot—no additional configuration files or properties are needed.
[CONTENT NEEDED: What does the user see when RSpond is running? Console output? Dashboard? Logs? Jonathan to describe expected output.]
Next steps