Build cloud-native microservices - service discovery, config server, API gateway, resilience patterns
Build production-ready microservices with Spring Cloud. Use when implementing service discovery (Eureka/Consul), API gateway routing, centralized config, or resilience patterns like circuit breakers and retries.
/plugin marketplace add pluginagentmarketplace/custom-plugin-spring-boot/plugin install spring-boot-assistant@pluginagentmarketplace-spring-bootThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/config.yamlassets/schema.jsonreferences/GUIDE.mdreferences/PATTERNS.mdscripts/validate.pyMaster building cloud-native microservices with Spring Cloud including service discovery, centralized configuration, API gateway, and resilience patterns.
This skill covers the complete Spring Cloud ecosystem for production-grade microservices architecture.
| Name | Type | Required | Default | Validation |
|---|---|---|---|---|
discovery | enum | ✗ | eureka | eureka | consul | kubernetes |
gateway | enum | ✗ | spring-cloud-gateway | spring-cloud-gateway | zuul |
resilience | enum | ✗ | resilience4j | resilience4j | hystrix |
@SpringBootApplication
@EnableEurekaServer
public class DiscoveryServerApplication {
public static void main(String[] args) {
SpringApplication.run(DiscoveryServerApplication.class, args);
}
}
# application.yml
server:
port: 8761
eureka:
client:
register-with-eureka: false
fetch-registry: false
@Configuration
public class GatewayConfig {
@Bean
public RouteLocator routes(RouteLocatorBuilder builder) {
return builder.routes()
.route("user-service", r -> r
.path("/api/users/**")
.filters(f -> f
.stripPrefix(1)
.circuitBreaker(c -> c.setName("userCB").setFallbackUri("forward:/fallback"))
.retry(retryConfig -> retryConfig.setRetries(3)))
.uri("lb://USER-SERVICE"))
.build();
}
}
@Service
public class OrderClient {
@CircuitBreaker(name = "orderService", fallbackMethod = "fallback")
@Retry(name = "orderService")
public List<Order> getOrders(Long userId) {
return restClient.get()
.uri("/orders?userId={userId}", userId)
.retrieve()
.body(new ParameterizedTypeReference<>() {});
}
public List<Order> fallback(Long userId, Throwable t) {
log.warn("Fallback for userId: {}", userId);
return Collections.emptyList();
}
}
# resilience4j configuration
resilience4j:
circuitbreaker:
instances:
orderService:
failure-rate-threshold: 50
wait-duration-in-open-state: 30s
sliding-window-size: 10
retry:
instances:
orderService:
max-attempts: 3
wait-duration: 1s
management:
tracing:
sampling:
probability: 1.0
zipkin:
tracing:
endpoint: http://localhost:9411/api/v2/spans
logging:
pattern:
level: "%5p [${spring.application.name},%X{traceId:-},%X{spanId:-}]"
| Issue | Diagnosis | Fix |
|---|---|---|
| Service not registered | Wrong Eureka URL | Check eureka.client.serviceUrl |
| Gateway 503 | No instances | Check service health |
| Circuit always open | Threshold too low | Adjust failure rate |
□ Check Eureka dashboard: http://localhost:8761
□ Verify gateway routes: /actuator/gateway/routes
□ Check circuit breaker state: /actuator/circuitbreakers
□ Test config refresh: POST /actuator/refresh
@SpringBootTest
@WireMockTest(httpPort = 8089)
class OrderClientTest {
@Autowired
private OrderClient orderClient;
@Test
void shouldReturnOrdersWhenServiceAvailable() {
stubFor(get(urlPathEqualTo("/orders"))
.willReturn(aResponse()
.withStatus(200)
.withBody("[]")));
List<Order> orders = orderClient.getOrders(1L);
assertThat(orders).isEmpty();
}
@Test
void shouldUseFallbackWhenServiceDown() {
stubFor(get(urlPathEqualTo("/orders"))
.willReturn(aResponse().withStatus(503)));
List<Order> orders = orderClient.getOrders(1L);
assertThat(orders).isEmpty(); // fallback
}
}
Skill("spring-microservices")
| Version | Date | Changes |
|---|---|---|
| 2.0.0 | 2024-12-30 | Resilience4j, Micrometer Tracing, gateway patterns |
| 1.0.0 | 2024-01-01 | Initial release |
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.