agents:
-
java-systems-specialist category: parallel description: 'Tactical Blueprint for production-grade Spring Boot 3+ applications. Focuses on procedural execution, tool-calling sequences, and idiomatic excellence.
' knowledge:
-
none name: building-spring-enterprise related_skills:
-
none templates:
-
none tools:
-
none type: skill version: 1.0.0 references:
-
none settings: auto_approve: false retry_limit: 3 timeout_seconds: 300 safe_to_parallelize: false orchestration_pattern: routing
Capability Manifest: Spring Boot Enterprise
This blueprint provides the procedural truth for engineering, testing, and deploying high-fidelity Spring Boot 3+ services in the Antigravity Agent Factory.
Operational Environment
- JDK: 21 (LTS) - Mandatory usage of
records,sealed classes, andswitch expressions. - Build: Maven 3.9+ (Wrapped).
- Primary Stack: Boot 3.4, Spring Data JPA (PostgreSQL), Spring Security (OIDC), Micrometer (OTEL).
Process
Follow these procedures to build enterprise-grade Spring Boot applications:
Procedure 1: Scaffolding a Service
Execute these steps in sequence to ensure standard factory hygiene:
- Generate:
mvn archetype:generate -Dfilter=antigravity-service-pattern(or use internalscaffold.py). - Verify Structure: Ensure
src/main/javafollowscom.antigravity.[domain].[service]pattern. - Truth Check: Validate that
pom.xmlcontains thespring-boot-starter-validationandspring-boot-starter-actuator.
Procedure 2: Implementing a Domain Feature (Red-Green-Refactor)
- Red: Create a Slice Test (e.g.,
@WebMvcTestfor API or@DataJpaTestfor Persistence).- Tool:
mvn test -Dtest=MyFeatureTest
- Tool:
- Green: Implement the service logic.
- Axiom Check: Use a
recordfor DTOs. Never leak Entities through the Controller.
- Axiom Check: Use a
- Refactor: Run Static Analysis.
- Tool:
mvn checkstyle:checkandmvn pmd:check.
- Tool:
Procedure 3: Resilience & Observability Setup
- Add Actuator: Ensure
/actuator/healthand/actuator/metricsare exposed but secured. - Configure Logging: Use
logback-spring.xmlwith JSON output for ELK/Loki. - Circuit Breakers: Use Resilience4j for all external API calls.
Process (Fail-State & Recovery)
| Symptom | Probable Cause | Recovery Operation |
|---|---|---|
BeanDefinitionOverrideException | Duplicate bean names in context. | Check for @Component vs @Bean duplication in @Configuration classes. Use @Primary only as a last resort. |
LazyInitializationException | Accessing proxy outside transaction. | Never use spring.jpa.open-in-view=true. Use DTO mapping within the @Service layer or EntityGraph. |
ConnectionTimeout | DB Pool saturation. | Check hikari.maximum-pool-size. Verify all DB streams/connections are within try-with-resources. |
Idiomatic Code Patterns (The Gold Standard)
The "Truthful" Record DTO
public record UserResponse(
UUID id,
@NotBlank String username,
@Email String email,
LocalDateTime createdAt
) {}
The "Observable" Service
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class OrderService {
private final ObservationRegistry observationRegistry;
@Transactional
public OrderResponse placeOrder(OrderRequest request) {
return Observation.createNotStarted("order.place", observationRegistry)
.observe(() -> {
// Business logic here
return new OrderResponse(...);
});
}
}
Prerequisites
| Action | Command |
|---|---|
| Build & Check | mvn clean verify |
| Fast Test Loop | mvn test -DskipITs |
| Check Vulnerabilities | mvn ossindex:audit |
| Format Code | mvn spotless:apply |
When to Use
Use this blueprint whenever building, refactoring, or debugging a Java/Spring service. It is the authoritative source for "How we build" vs "What Spring is."
Best Practices
- Follow the system axioms (A1-A5)
- Ensure all changes are verifiable
- Document complex logic for future maintenance