Bring organization-wide API consistency to every Spring Boot service.
Turn Spring Boot into a governed API platform with one dependency. Standardize responses, errors, tracing, and OpenAPI documentation automatically.
[](https://spring.io/projects/spring-boot) [](https://www.oracle.com/java/technologies/downloads/#java21) [](https://github.com/saul789/api-standard-spring-boot-starter/releases) [](https://opensource.org/licenses/MIT) [](https://saul789.github.io/api-standard-spring-boot-starter/)A plug-and-play Spring Boot starter that standardizes API responses, implements RFC 9457 (Problem Details for HTTP APIs), and provides distributed tracing via Trace Context propagation.
</div>
Most organizations eventually create:
GlobalExceptionHandlers in every projectApiResponse wrappersThis starter centralizes those cross-cutting concerns into a single reusable standard. Stop reinventing the wheel and eliminate boilerplate technical debt.
Add the dependency and keep building your API. We handle the rest.
graph TD
A[Client Request] --> B[TraceContextFilter]
B --> C[Spring Controller]
C -- "Throws Exception" --> D[GlobalExceptionHandler]
D --> E[ProblemDetailService]
E -- "1. Map ErrorCode" --> F[i18n Messages]
E -- "2. Enrich metadata" --> G[Enricher SPI]
F --> H[ProblemDetail JSON]
G --> H
H --> I[Client Response RFC 9457]
subgraph "api-standard-starter"
D
E
F
G
end
<dependency>
<groupId>io.github.saul789</groupId>
<artifactId>api-standard-spring-boot-starter</artifactId>
<version>2.0.0</version>
</dependency>
@RestController
@RequestMapping("/api/users")
public class UserController {
@GetMapping("/{id}")
public User get(@PathVariable String id) {
throw new BusinessException(ErrorCode.NOT_FOUND, "User not found", HttpStatus.NOT_FOUND);
}
}
Without writing any boilerplate, your API now automatically returns standardized responses, RFC 9457 errors, traceIds, auto-generated OpenAPI schemas, and translated messages.
By simply returning objects or throwing exceptions, the starter enforces a rigorous contract globally:
{
"success": true,
"timestamp": "2026-05-10T18:34:45Z",
"data": {
"id": "123",
"name": "Jane Doe"
}
}
{
"type": "https://api.yourdomain.com/errors/not-found",
"title": "User Not Found",
"status": 404,
"detail": "User with ID 123 does not exist",
"instance": "/api/users/123",
"code": "NOT_FOUND",
"timestamp": "2026-05-10T18:34:46Z",
"traceId": "5f9b3b8c-1234-4a56-b789-abcdef123456"
}
π‘ Bonus: Transparent MDC Logging Every request gets a
traceIdinjected into SLF4J MDC instantly. Watch your logs become 10x easier to debug:INFO [traceId: 5f9b3b8c-1234...] c.s.UserController: Fetching user 123
| Capability | Traditional Setup | This Starter |
|---|---|---|
| RFC 9457 Compliance | Manual construction | β Automatic |
| OpenAPI Response Wrapping | Manual annotations on every method | β Automatic |
| TraceId Propagation | Custom Servlet filters | β Built-in |
| Error Translation (i18n) | Custom boilerplate | β Built-in |
| Organization-wide Consistency | Hard to enforce | β Automatic |
Before (Manual & Boilerplate):
- @RestControllerAdvice
- public class GlobalExceptionHandler { ... }
-
- public class ApiResponse<T> { ... }
-
- @Component
- public class TraceFilter extends OncePerRequestFilter { ... }
-
- @PostMapping
- @ApiResponses({
- @ApiResponse(responseCode = "200", description = "Success"),
- @ApiResponse(responseCode = "400", description = "Bad Request")
- })
- public ResponseEntity<ApiResponse<User>> createUser(@RequestBody UserRequest request) { ... }
After (Using this Starter):
+ @PostMapping
+ @ResponseStatus(HttpStatus.CREATED)
+ public User createUser(@Valid @RequestBody UserRequest request) {
+ return userService.create(request);
+ }
Built for large-scale microservice platforms from day one:
The starter integrates deeply with Spring Boot auto-configuration:
ResponseBodyAdvice standardizes responses automatically.@RestControllerAdvice maps exceptions into RFC 9457 format.traceId into the SLF4J MDC.MessageSource enables transparent i18n translation.No annotations required.
Building the ultimate API governance platform for Spring Boot:
spring.factories.sample-project/postman/api-standard-spring-boot-starter.postman_collection.json. (Importable in Postman, Insomnia, Bruno, Hoppscotch, etc.)This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Do you find this useful? Give us a β on GitHub to support the project!