Under-Utils
stable 1.0.2 1.0.3-SNAPSHOT
starter

Spring Starter

under-utils-spring-starter

请求上下文、限流、防重复提交、本地 store 和基础 SPI 自动装配。

依赖

under-utils-spring-starter Maven 坐标
<dependency>
    <groupId>io.github.yexianglun-d</groupId>
    <artifactId>under-utils-spring-starter</artifactId>
    <version>1.0.2</version>
</dependency>

适用场景

普通 Spring Boot 服务的首选轻量入口。

能力边界

文档来源 under-utils-spring-starter/README.md
API 入口 查看 Spring Starter 相关 API
设计约束 保留失败语义、配置 key 和 public API 兼容性说明,不以营销描述替代真实边界。

README 同步内容

来源:under-utils-spring-starter/README.md,构建时自动读取并渲染。

Spring Boot 自动装配模块,只接入 under-utils-spring 的本地横切能力,不引入 under-utils-redis 和 Redisson。

适合只需要请求上下文、限流、防重复提交、操作 key 和本地状态存储的服务。

依赖

<dependency>
    <groupId>io.github.yexianglun-d</groupId>
    <artifactId>under-utils-spring-starter</artifactId>
    <version>1.0.2</version>
</dependency>

自动装配 Bean

默认 Bean:

  • CurrentUserProvider
  • CurrentTenantProvider
  • TraceIdProvider
  • OperationKeyResolver
  • OperationContextFilter
  • OperationContextTaskDecorator
  • RateLimitAspect
  • PreventRepeatAspect
  • local RateLimitStore
  • local RepeatSubmitStore

配置

under:
  utils:
    web:
      operation-context:
        enabled: true
        task-decorator-enabled: true
      rate-limit:
        enabled: true
        store: local
      repeat-submit:
        enabled: true
        store: local

退让规则

starter 不会替换业务项目中同角色 Bean。常见退让点:

  • CurrentUserProvider
  • CurrentTenantProvider
  • TraceIdProvider
  • OperationKeyResolver
  • TaskDecorator
  • RateLimitStore
  • RepeatSubmitStore

多实例服务如果需要集群级限流和防重复提交,应使用 under-utils-redis-starter,或自行实现 RateLimitStore / RepeatSubmitStore