Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

meituan-spring-boot-starter

English | 简体中文

Spring Boot 2.3.12.RELEASE Java License

Spring Boot starter for the Meituan Open Platform multi-tenant SDK (meituan-sdk-extension): one dependency wires config binding, tenant storage, the official-client factory, the tenant-aware executor and all business services. This branch targets Spring Boot 2.3.12.RELEASE on JDK 8.

Table of Contents

1. Project Overview

The Meituan integration is split in two artifacts:

  • meituan-sdk-extension — framework-free core: tenant config model, pluggable tenant storage, per-tenant official-client factory/cache and 14 typed business facades over the official MtOpJavaSDK.
  • meituan-spring-boot-starter (this repo) — the Spring Boot integration: binds meituan.* properties, registers every bean with @ConditionalOnMissingBean overrides, and can be switched off entirely with meituan.enabled=false.

One branch per Spring Boot version line — pick the branch that matches your Boot version (see section 10).

2. Features & Status

Area Status
meituan.* configuration binding (MeituanProperties)
Auto-registration of config / tenant storage / client factory / executor
Auto-registration of all 14 Meituan*Service beans
@ConditionalOnMissingBean overrides for every bean
meituan.enabled master switch (matchIfMissing = true)
spring.factories + AutoConfiguration.imports dual registration (Boot 2.3 – 4.x)
Configuration metadata via spring-boot-configuration-processor

3. Requirements & Compatibility

Dependency Version (this branch)
Java 1.8+
Spring Boot 2.3.12.RELEASE
Core SDK io.github.easy4j:meituan-sdk-extension
Official SDK com.sankuai.sjst:MtOpJavaSDK (vendored by the core repo under libs/)

4. Architecture & Modules

Package / Resource Responsibility
io.github.easy4j.meituan.spring.boot.MeituanProperties meituan.* binding (prefix meituan)
io.github.easy4j.meituan.spring.boot.MeituanAutoConfiguration Bean registration entry
META-INF/spring.factories Boot 2.3-era auto-configuration registration
META-INF/spring/...AutoConfiguration.imports Boot 2.7+ auto-configuration registration

Beans registered (all overridable): MeituanConfig, MeituanTenantConfigStorage (in-memory, seeded from meituan.tenants.*), MeituanClientFactory, MeituanRequestExecutor, and the 14 business services (catering, daocan, delivery, distribution, freetry, kemanman, kuailv, live, pay, retail, store, tools, travel, waimai).

5. Installation

<dependency>
    <groupId>io.github.easy4j</groupId>
    <artifactId>meituan-spring-boot-starter</artifactId>
    <version>1.0.x.20260630-SNAPSHOT</version>
</dependency>

6. Quick Start

Add the starter, configure one tenant, inject a service:

@Service
public class OrderService {

    private final MeituanWaimaiService waimaiService;

    public OrderService(MeituanWaimaiService waimaiService) {
        this.waimaiService = waimaiService;
    }

    public MeituanResponse<?> queryOrder(String orderId, String tenantId) {
        return waimaiService.orderQueryById(request, tenantId);
    }
}

7. Configuration

meituan:
  enabled: true                # master switch, default true
  server-url: https://api-open-cater.meituan.com
  charset: UTF-8
  version: "2"
  connect-timeout: 5000
  read-timeout: 10000
  tenants:
    tenant-a:
      app-id: app-a
      developer-id: 100000
      sign-key: your-sign-key
      app-auth-token: token-a
      business-id: 16

8. Core Usage / API

Business APIs live in the core SDK — see meituan-sdk-extension for the full facade/executor documentation. From Spring you simply inject any Meituan*Service (or MeituanRequestExecutor) and pass the tenantId per call.

9. Testing & Build

mvn -B clean verify

CI resolves the JDK from the branch name and installs the core SDK from source before verifying, so no private repository access is required. JaCoCo enforces 90% line coverage on this starter.

10. Versioning & Branches

One branch per Spring Boot line; the version is <line>.20260630-SNAPSHOT:

Branch Spring Boot Compile JDK Core SDK line Version
feature/1.0.x 2.3.12.RELEASE 1.8 feature/1.0.x 1.0.x.20260630-SNAPSHOT
feature/2.0.x 2.7.18 1.8 feature/1.0.x 2.0.x.20260630-SNAPSHOT
feature/3.0.x 3.0.13 17 feature/2.0.x 3.0.x.20260630-SNAPSHOT
feature/3.1.x 3.1.12 17 feature/2.0.x 3.1.x.20260630-SNAPSHOT
feature/3.2.x 3.2.12 17 feature/2.0.x 3.2.x.20260630-SNAPSHOT
feature/3.3.x 3.3.13 17 feature/2.0.x 3.3.x.20260630-SNAPSHOT
feature/3.4.x 3.4.13 17 feature/2.0.x 3.4.x.20260630-SNAPSHOT
feature/3.5.x 3.5.16 17 feature/2.0.x 3.5.x.20260630-SNAPSHOT
feature/4.0.x 4.0.7 21 feature/3.0.x 4.0.x.20260630-SNAPSHOT
feature/4.1.x 4.1.0 21 feature/3.0.x 4.1.x.20260630-SNAPSHOT

11. Contributing & License

Licensed under Apache License 2.0. The underlying MtOpJavaSDK remains proprietary to Meituan (三快科技). Issues and PRs are welcome at github.com/easy-4-java/meituan-spring-boot-starter.

About

Spring Boot starter for Meituan SDK Extension: one branch per Spring Boot line (2.3 - 4.1)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages