resolve a mapper's constructor dependencies when creating via Mappers.getMapper#3736
resolve a mapper's constructor dependencies when creating via Mappers.getMapper#3736AlexElin wants to merge 1 commit intomapstruct:mainfrom
Mappers.getMapper#3736Conversation
|
This is a bit tricky @AlexElin. What if one of the parameters for the constructor is not a mapper? What if there is a cyclic dependency? I would rather leave the |
|
I'm passing by it, there's a bug on Intellij in Java 11, when i put In the unit tests It throws a error: java.lang.RuntimeException: java.lang.NoSuchMethodException: Debugging the code it' happen when calling the line 49 of the method doGetMapper: Constructor constructor = implementation.getDeclaredConstructor() at the When i change the injection strategy, it's change the behavior and i'ts work: InjectionStrategy.SETTER Please accept the fix of AlexELin, it'll help everyone |
|
@RafaelRfs that's not a bug in IntelliJ, it's rather a wrong usage of the As I wrote in my earlier comment, I am not a fan of making You can always just use |
|
When using Spring, why calling the factory and not letting Spring inject the mapper? |
At the moment when a mapper depends on another mappers which are passed via constructor, the call
Mappers.getMapper(...)fails with an exception "java.lang.NoSuchMethodException: MapperName.()"This pull request fixes the issue by resolving such dependencies