Back to Skills

spring-cloud

verified

Provides comprehensive guidance for Spring Cloud microservices including service discovery, configuration management, load balancing, circuit breakers, API gateways, and distributed tracing. Use when the user asks about Spring Cloud, needs to build microservices, implement service discovery, or work with Spring Cloud components.

View on GitHub

Marketplace

full-stack-skills

partme-ai/full-stack-skills

Plugin

development-skills-utils

Repository

partme-ai/full-stack-skills
39stars

skills/spring-cloud/SKILL.md

Last Verified

February 1, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/partme-ai/full-stack-skills/blob/main/skills/spring-cloud/SKILL.md -a claude-code --skill spring-cloud

Installation paths:

Claude
.claude/skills/spring-cloud/
Powered by add-skill CLI

Instructions

# Spring Cloud 微服务开发指南

## 概述

Spring Cloud 是一套完整的微服务解决方案,提供了服务注册与发现、配置管理、网关、负载均衡、熔断器等组件。

## 核心组件

### 1. 服务注册与发现(Eureka)

**Eureka Server**:

```java
@SpringBootApplication
@EnableEurekaServer
public class EurekaServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(EurekaServerApplication.class, args);
    }
}
```

**application.yml**:

```yaml
server:
  port: 8761

eureka:
  instance:
    hostname: localhost
  client:
    register-with-eureka: false
    fetch-registry: false
    service-url:
      defaultZone: http://${eureka.instance.hostname}:${server.port}/eureka/
```

**Eureka Client**:

```java
@SpringBootApplication
@EnableEurekaClient
public class UserServiceApplication {
    public static void main(String[] args) {
        SpringApplication.run(UserServiceApplication.class, args);
    }
}
```

**application.yml**:

```yaml
spring:
  application:
    name: user-service

eureka:
  client:
    service-url:
      defaultZone: http://localhost:8761/eureka/
```

### 2. 配置中心(Config Server)

**Config Server**:

```java
@SpringBootApplication
@EnableConfigServer
public class ConfigServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ConfigServerApplication.class, args);
    }
}
```

**application.yml**:

```yaml
server:
  port: 8888

spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/example/config-repo
          search-paths: '{application}'
```

**Config Client**:

```yaml
spring:
  application:
    name: user-service
  cloud:
    config:
      uri: http://localhost:8888
      name: user-service
      profile: dev
```

### 3. API 网关(Gateway)

**Gateway 配置**:

```java
@SpringBootApplication
public class GatewayApplication {
    public static void main(String[] args) {
        SpringApplication.run(GatewayApplication.class, args);
    }
}
```

**application.yml**:

```yaml
spring:
  cloud:
    gateway:
      routes:
        - id: user-service
 

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
6735 chars