apache / apache/incubator-seata
SeataAutoDataSourceProxyCreator's override about AbstractAutoProxyCreator#wrapIfNecessary is unnecessary and non-compliant
- Dominant language
- Java
- Stars
- 26k
- Forks
- 8.8k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 4
Description
The AbstractAutoProxyCreator's wrapIfNecessary method does not expect to be overridden by subclasses, whereas getAdvicesAndAdvisorsForBean and shouldSkip expect to be overridden by subclasses even more.
The logic of SeataAutoDataSourceProxyCreator's override of wrapIfNecessary can be done entirely in getAdvicesAndAdvisorsForBean and shouldSkip.
For example, the logic in the red box below can be done entirely in shouldSkip

Meanwhile, the following logic for SeataDataSourceProxy creation can be done entirely in getAdvicesAndAdvisorsForBean, passing the created proxy to SeataAutoDataSourceProxyAdvice via the constructor

This also means that the existence of the DataSourceProxyHolder is unnecessary
Contributor guide
Research direction
Start by locating SeataAutoDataSourceProxyCreator, SeataAutoDataSourceProxyAdvice, DataSourceProxyHolder, and the inherited wrapIfNecessary, getAdvicesAndAdvisorsForBean, and shouldSkip entry points. Trace the current proxy-creation and skip logic, then verify that the override and holder can be removed while behavior is preserved; the issue provides no named tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100