apache / apache/shenyu

[BUG] ApiBean.copy() back-references the original ApiBean, losing processor-applied beanPath

Open Beginner friendly
#6,553 1 comment 0 reactions 0 assignees View on GitHub
client: spring-mvc priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
The copied `ApiDefinition`s are constructed with `new ApiDefinition(this, ...)` so each copy's `apiBean` field points back at the **original** `ApiBean`, not at `copy`. Registrars read the path via `api.getApiBean().getBeanPath()`, so a processor's `setBeanPath` on the copy is silently lost.

## Location
```
shenyu-client-core/.../register/ApiBean.java:245-254
MateDataApiRegistrarImpl.java:183-185, ApiDocRegistrarImpl.java:170-172
```

## Impact
A class-level path override set on the copy (e.g. `@ShenyuSpringMvcClient(path="/foo")` with no class `@RequestMapping`) is dropped from the registered path.

## Suggested fix
`new ApiDefinition(copy, definition.apiMethod, definition.methodPath)`.

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in shenyu-client-core/.../register/ApiBean.java at lines 245-254, then inspect the ApiDefinition consumers in MateDataApiRegistrarImpl.java and ApiDocRegistrarImpl.java at the cited lines. Verify that copied definitions retain the copied ApiBean's processor-applied beanPath and that registration uses the overridden path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.