apache / apache/incubator-seata

SeataAutoDataSourceProxyCreator's override about AbstractAutoProxyCreator#wrapIfNecessary is unnecessary and non-compliant

Open
#6,376 2 comments 0 reactions 0 assignees View on GitHub
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
![image](https://github.com/apache/incubator-seata/assets/77573225/b8224e4a-88e7-4ee7-a834-452942775df1)
Meanwhile, the following logic for SeataDataSourceProxy creation can be done entirely in getAdvicesAndAdvisorsForBean, passing the created proxy to SeataAutoDataSourceProxyAdvice via the constructor
![image](https://github.com/apache/incubator-seata/assets/77573225/8d4ed1ac-8d44-4e23-9cc8-0308fe72a857)

This also means that the existence of the DataSourceProxyHolder is unnecessary

Contributor guide

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.