mapstruct / mapstruct/mapstruct
Make constructor injection the default
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 7.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
As there is a modern consensus that [constructor injection should be preferred to field injection](http://olivergierke.de/2013/11/why-field-injection-is-evil/), I suggest making the injection strategy default to CONSTRUCTOR. I'm aware that this might be considered a breaking change and a candidate for 2.0, but since MapStruct is based around interface definitions it might conceivably make sense in 1.4.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue proposes changing MapStruct's default injection strategy to CONSTRUCTOR and notes that this may be a breaking change. Start by locating the injection-strategy entry point and reviewing how interface definitions are processed; done means the default behavior is changed without requiring users to select CONSTRUCTOR explicitly, with the compatibility impact addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100