Expected behavior
Hi guys, how are you?
Thanks by awesome working that you are doing,
i'm here to report a bug that i've got :
when i'm trying to use the class Mappers.getMappers(SomeMapperClass.class)
with the component model = "spring"
and the injectionStrategy = InjectionStrategy.CONSTRUCTOR is configured,
with uses = {
OtherMapper.class
}
CODE:
@Mapper(componentModel = "spring", uses = {
TechnologiesMapper.class
},injectionStrategy = InjectionStrategy.CONSTRUCTOR)
public interface ProjectsMapper {
Project mapToProject(ProjectsDomain projectsDomain);
}
there's a bug that says "no such method error", i think i'ts because the others or whether you create more than one construtor at the class generated, it can solve because of the use of the reflection ...
Reading the PRs i see that AlexELin created a fix ...
Actual behavior
Error no suchMethodException
Steps to reproduce the problem
In the unit tests
package com.site.rfs.blog.dataproviders.mappers;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mapstruct.factory.Mappers;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import static org.junit.jupiter.api.Assertions.*;
@ExtendWith(SpringExtension.class)
class ProjectsMapperTest {
private ProjectsMapper projectsMapper;
@BeforeEach
public void setUp(){
this.projectsMapper = Mappers.getMapper(ProjectsMapper.class);
}
@Test
public void test(){
assertNotNull(this.projectsMapper);
}
}
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
or
InjectionStrategy.FIELD(default);
Please accept the fix of AlexELin, it'll help everyone
#3736
MapStruct Version
1.6.3
Expected behavior
Hi guys, how are you?
Thanks by awesome working that you are doing,
i'm here to report a bug that i've got :
when i'm trying to use the class Mappers.getMappers(SomeMapperClass.class)
with the component model = "spring"
and the injectionStrategy = InjectionStrategy.CONSTRUCTOR is configured,
with uses = {
OtherMapper.class
}
CODE:
there's a bug that says "no such method error", i think i'ts because the others or whether you create more than one construtor at the class generated, it can solve because of the use of the reflection ...
Reading the PRs i see that AlexELin created a fix ...
Actual behavior
Error no suchMethodException
Steps to reproduce the problem
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
or
InjectionStrategy.FIELD(default);
Please accept the fix of AlexELin, it'll help everyone
#3736
MapStruct Version
1.6.3