Quick Start Guide to Spring Cloud Tencent with Polaris Service Discovery
This guide introduces Spring Cloud Tencent, a one‑stop microservice solution that integrates Spring Cloud with Tencent's Polaris service discovery, and provides step‑by‑step instructions—including building the project, adding dependencies, configuring application.yml, and running the application—to quickly set up a functional Spring Cloud Tencent service.
Spring Cloud Tencent is a one‑stop microservice solution built on Spring Cloud SPI, integrating Spring Cloud with Tencent middleware to simplify development, testing, publishing, and operation of distributed services.
Service Discovery and Governance
Spring Cloud Tencent integrates Spring Cloud with Polaris, a multi‑language, multi‑framework service discovery and governance platform.
Polaris Github ( https://github.com/polarismesh/polaris )
Integrating Polaris with Spring Cloud provides service management (discovery, health check), traffic control (custom routing, load balancing, rate limiting, access control), fault tolerance (circuit breaking, degradation, instance failover), and configuration management (versioning, gray release, dynamic updates).
How to Build
Run the following command to build.
Linux and Mac
./mvnw clean packageWindows
.\mvnw.cmd clean packageQuick Start
Prerequisites
Refer to the Polaris server installation documentation to set up a Polaris server environment. For a fast experience, use the official Polaris demo environment without installation.
Polaris console: http://119.91.66.223/ Username: polaris Password: polaris
Service address: grpc://119.91.66.223:8091
Step 1: Generate Spring Cloud project
Create a Spring Cloud starter project via https://start.spring.io/ or an IDE. The example screenshot below shows the generated project, which can then be opened in the IDE.
Step 2: Add Spring Cloud Tencent dependencies
Select the appropriate SCT version that matches your Spring Boot version (2.7.6). Use Spring Cloud 2021 as recommended.
https://github.com/Tencent/spring-cloud-tencent/wiki/Spring-Cloud-Tencent-Version-Management
Add the following Maven dependencies:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-tencent-dependencies</artifactId>
<version>1.11.8-2021.0.6</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- New projects are recommended to use the all starter to import all SCT starters at once. Existing projects can add specific starters to avoid conflicts. -->
<dependencies>
<dependency>
<groupId>com.tencent.cloud</groupId>
<artifactId>spring-cloud-starter-tencent-all</artifactId>
</dependency>
</dependencies>Step 3: Add SCT configuration file
Create application.yml under the resources directory with the following content:
server:
port: 8080
spring:
application:
name: sct-quickstart-caller
config:
import: polaris
cloud:
polaris:
address: grpc://119.91.66.223:8091
namespace: defaultStep 4: Start the project
After the project starts successfully, view the service registration information in the Polaris console.
At this point, a fully functional Spring Cloud Tencent project has been created.
Usage Example
Service List
Routing
Circuit Breaker
Rate Limiting
Observability
Portal
Open‑source repository: https://github.com/Tencent/spring-cloud-tencent
Source: Open‑source Technology Column
Backend Exclusive Technical Group
Build a high‑quality technical community; developers, technical recruiters, and anyone interested are welcome to join and share opportunities.
Communicate responsibly, focusing on technical exchange , job referrals , and industry discussion .
Advertisements are prohibited; beware of private scams.
Add me as a friend, I will invite you to the group.
Selected Java Interview Questions
A professional Java tech channel sharing common knowledge to help developers fill gaps. Follow us!
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.