[BUG] ShenyuDictServiceImpl.importData missing @Transactional
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
- severity: Medium
- files: `shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ShenyuDictServiceImpl.java:110-143`
- description: `importData` loops calling private `create(dictDTO)` (which does `insertSelective` + `publisher.onCreated`). No `@Transactional`. A DB-level failure on one row leaves prior inserts committed and the rest skipped. Also, `publisher.onCreated` events are fired before any guarantee of overall success.
- impact: Partial dict import with already-published create events for rows that may need to be rolled back.
- suggested_fix: Add `@Transactional(rollbackFor = Exception.class)`.
- confidence: Medium
- related_existing: none.
---
_Identified during the 2026-08-02 deep re-scan; full list in [`docs/scan2-2026-08-02/06-medium-tiers.md`](docs/scan2-2026-08-02/06-medium-tiers.md)._
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/ShenyuDictServiceImpl.java:110-143 and inspect importData alongside the private create(dictDTO) it calls. Confirm the current insertSelective and publisher.onCreated flow, then verify that a database failure during import rolls back earlier rows and does not leave partial import effects. Done means importData has the requested transaction rollback behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100