Error creating MapStruct bean with Spring
Trying to do some tests with MapStruct here. I have the following classes:
Test Class
RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class MapperTests {
@Autowired
private UsuarioMapper usuarioMapper; //Can't autowire(No typo found)
@Test
public void dadoUsuarioSalvarDTO_quandoMapeioParaUsuario_entaoRetornaUsuario(){
//Dado
UsuarioSalvarDTO usuarioSalvarDTO = new UsuarioSalvarDTO();
usuarioSalvarDTO.setEmail("test@test.com");
usuarioSalvarDTO.setSenha("123456789");
usuarioSalvarDTO.setStatus(TipoStatus.ATIVO);
Usuario usuario = usuarioMapper.toEntity(usuarioSalvarDTO);
Assert.assertEquals(usuario.getEmail(), "test@test.com");
Assert.assertEquals(usuario.getSenha(), "123456789");
Assert.assertEquals(usuario.getStatus(), TipoStatus.ATIVO);
}
}
Mapper
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.WARN)
public interface UsuarioMapper {
@Mappings({
@Mapping(target = "id", ignore = true),
@Mapping(target = "createdAt", ignore = true),
@Mapping(target = "updatetAt", ignore = true),
@Mapping(source="usuarioSalvarDTO.email", target = "email")
})
Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO);
}
Consider Models here
Generated UsuarioMapperImpl:
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2018-11-24T00:40:25-0200",
comments = "version: 1.2.0.Final, compiler: javac, environment: Java 1.8.0_181 (Oracle Corporation)"
)
@Component
public class UsuarioMapperImpl implements UsuarioMapper {
@Override
public Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO) {
if ( usuarioSalvarDTO == null ) {
return null;
}
Usuario usuario = new Usuario();
usuario.setEmail( usuarioSalvarDTO.getEmail() );
usuario.setSenha( usuarioSalvarDTO.getSenha() );
usuario.setStatus( usuarioSalvarDTO.getStatus() );
return usuario;
}
}
When i try to run the test, he gives the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'br.com.financeiroAdam.demo.MapperTests': Unsatisfied dependency expressed through field 'usuarioMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'br.com.financeiroAdam.demo.mapper.UsuarioMapper' available: expected at least 1 bean which qualifies as autowire candidate.
@Autowire in MapperTest don't work. It claims: 'Could not autowire. No beans of 'UsuarioMapper' type found.'
Already tried:
- gradle build (no errors)
- gradle build -x test (no errors)
- Invalidate Caches / Restart
- Re-import project
Using:
- IntelliJ
- Gradle
- Spring
- Lombok
build.gradle
buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'net.ltgt.apt' version '0.8'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'br.com.financeiroAdam'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok:1.18.2')
compile 'org.mapstruct:mapstruct-jdk8:1.2.0.Final'
testImplementation('org.springframework.boot:spring-boot-starter-test')
apt('org.projectlombok:lombok:1.18.2')
apt('org.mapstruct:mapstruct-processor:1.2.0.Final')
}
Tried everything. I think the mapstruct simply does not want to work.
Any solutions?
java spring mapstruct
add a comment |
Trying to do some tests with MapStruct here. I have the following classes:
Test Class
RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class MapperTests {
@Autowired
private UsuarioMapper usuarioMapper; //Can't autowire(No typo found)
@Test
public void dadoUsuarioSalvarDTO_quandoMapeioParaUsuario_entaoRetornaUsuario(){
//Dado
UsuarioSalvarDTO usuarioSalvarDTO = new UsuarioSalvarDTO();
usuarioSalvarDTO.setEmail("test@test.com");
usuarioSalvarDTO.setSenha("123456789");
usuarioSalvarDTO.setStatus(TipoStatus.ATIVO);
Usuario usuario = usuarioMapper.toEntity(usuarioSalvarDTO);
Assert.assertEquals(usuario.getEmail(), "test@test.com");
Assert.assertEquals(usuario.getSenha(), "123456789");
Assert.assertEquals(usuario.getStatus(), TipoStatus.ATIVO);
}
}
Mapper
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.WARN)
public interface UsuarioMapper {
@Mappings({
@Mapping(target = "id", ignore = true),
@Mapping(target = "createdAt", ignore = true),
@Mapping(target = "updatetAt", ignore = true),
@Mapping(source="usuarioSalvarDTO.email", target = "email")
})
Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO);
}
Consider Models here
Generated UsuarioMapperImpl:
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2018-11-24T00:40:25-0200",
comments = "version: 1.2.0.Final, compiler: javac, environment: Java 1.8.0_181 (Oracle Corporation)"
)
@Component
public class UsuarioMapperImpl implements UsuarioMapper {
@Override
public Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO) {
if ( usuarioSalvarDTO == null ) {
return null;
}
Usuario usuario = new Usuario();
usuario.setEmail( usuarioSalvarDTO.getEmail() );
usuario.setSenha( usuarioSalvarDTO.getSenha() );
usuario.setStatus( usuarioSalvarDTO.getStatus() );
return usuario;
}
}
When i try to run the test, he gives the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'br.com.financeiroAdam.demo.MapperTests': Unsatisfied dependency expressed through field 'usuarioMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'br.com.financeiroAdam.demo.mapper.UsuarioMapper' available: expected at least 1 bean which qualifies as autowire candidate.
@Autowire in MapperTest don't work. It claims: 'Could not autowire. No beans of 'UsuarioMapper' type found.'
Already tried:
- gradle build (no errors)
- gradle build -x test (no errors)
- Invalidate Caches / Restart
- Re-import project
Using:
- IntelliJ
- Gradle
- Spring
- Lombok
build.gradle
buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'net.ltgt.apt' version '0.8'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'br.com.financeiroAdam'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok:1.18.2')
compile 'org.mapstruct:mapstruct-jdk8:1.2.0.Final'
testImplementation('org.springframework.boot:spring-boot-starter-test')
apt('org.projectlombok:lombok:1.18.2')
apt('org.mapstruct:mapstruct-processor:1.2.0.Final')
}
Tried everything. I think the mapstruct simply does not want to work.
Any solutions?
java spring mapstruct
Hello, could you try the solution in stackoverflow.com/a/52884637/4611077 .
– DonatasD
Nov 24 '18 at 4:34
In addition to the remark of @DonatasD above: MapStruct is a code generator. If the code is not there when your tests execute, there's nothing to autowire
– Sjaak
Nov 24 '18 at 10:46
@DonatasD still dont finding bean of type UsuarioMapper on Autowire
– DaMews
Nov 24 '18 at 10:54
@sjaak But the Impl class is generated. How Autowire cannot find it?
– DaMews
Nov 24 '18 at 10:55
add a comment |
Trying to do some tests with MapStruct here. I have the following classes:
Test Class
RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class MapperTests {
@Autowired
private UsuarioMapper usuarioMapper; //Can't autowire(No typo found)
@Test
public void dadoUsuarioSalvarDTO_quandoMapeioParaUsuario_entaoRetornaUsuario(){
//Dado
UsuarioSalvarDTO usuarioSalvarDTO = new UsuarioSalvarDTO();
usuarioSalvarDTO.setEmail("test@test.com");
usuarioSalvarDTO.setSenha("123456789");
usuarioSalvarDTO.setStatus(TipoStatus.ATIVO);
Usuario usuario = usuarioMapper.toEntity(usuarioSalvarDTO);
Assert.assertEquals(usuario.getEmail(), "test@test.com");
Assert.assertEquals(usuario.getSenha(), "123456789");
Assert.assertEquals(usuario.getStatus(), TipoStatus.ATIVO);
}
}
Mapper
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.WARN)
public interface UsuarioMapper {
@Mappings({
@Mapping(target = "id", ignore = true),
@Mapping(target = "createdAt", ignore = true),
@Mapping(target = "updatetAt", ignore = true),
@Mapping(source="usuarioSalvarDTO.email", target = "email")
})
Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO);
}
Consider Models here
Generated UsuarioMapperImpl:
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2018-11-24T00:40:25-0200",
comments = "version: 1.2.0.Final, compiler: javac, environment: Java 1.8.0_181 (Oracle Corporation)"
)
@Component
public class UsuarioMapperImpl implements UsuarioMapper {
@Override
public Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO) {
if ( usuarioSalvarDTO == null ) {
return null;
}
Usuario usuario = new Usuario();
usuario.setEmail( usuarioSalvarDTO.getEmail() );
usuario.setSenha( usuarioSalvarDTO.getSenha() );
usuario.setStatus( usuarioSalvarDTO.getStatus() );
return usuario;
}
}
When i try to run the test, he gives the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'br.com.financeiroAdam.demo.MapperTests': Unsatisfied dependency expressed through field 'usuarioMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'br.com.financeiroAdam.demo.mapper.UsuarioMapper' available: expected at least 1 bean which qualifies as autowire candidate.
@Autowire in MapperTest don't work. It claims: 'Could not autowire. No beans of 'UsuarioMapper' type found.'
Already tried:
- gradle build (no errors)
- gradle build -x test (no errors)
- Invalidate Caches / Restart
- Re-import project
Using:
- IntelliJ
- Gradle
- Spring
- Lombok
build.gradle
buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'net.ltgt.apt' version '0.8'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'br.com.financeiroAdam'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok:1.18.2')
compile 'org.mapstruct:mapstruct-jdk8:1.2.0.Final'
testImplementation('org.springframework.boot:spring-boot-starter-test')
apt('org.projectlombok:lombok:1.18.2')
apt('org.mapstruct:mapstruct-processor:1.2.0.Final')
}
Tried everything. I think the mapstruct simply does not want to work.
Any solutions?
java spring mapstruct
Trying to do some tests with MapStruct here. I have the following classes:
Test Class
RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest
public class MapperTests {
@Autowired
private UsuarioMapper usuarioMapper; //Can't autowire(No typo found)
@Test
public void dadoUsuarioSalvarDTO_quandoMapeioParaUsuario_entaoRetornaUsuario(){
//Dado
UsuarioSalvarDTO usuarioSalvarDTO = new UsuarioSalvarDTO();
usuarioSalvarDTO.setEmail("test@test.com");
usuarioSalvarDTO.setSenha("123456789");
usuarioSalvarDTO.setStatus(TipoStatus.ATIVO);
Usuario usuario = usuarioMapper.toEntity(usuarioSalvarDTO);
Assert.assertEquals(usuario.getEmail(), "test@test.com");
Assert.assertEquals(usuario.getSenha(), "123456789");
Assert.assertEquals(usuario.getStatus(), TipoStatus.ATIVO);
}
}
Mapper
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.WARN)
public interface UsuarioMapper {
@Mappings({
@Mapping(target = "id", ignore = true),
@Mapping(target = "createdAt", ignore = true),
@Mapping(target = "updatetAt", ignore = true),
@Mapping(source="usuarioSalvarDTO.email", target = "email")
})
Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO);
}
Consider Models here
Generated UsuarioMapperImpl:
@Generated(
value = "org.mapstruct.ap.MappingProcessor",
date = "2018-11-24T00:40:25-0200",
comments = "version: 1.2.0.Final, compiler: javac, environment: Java 1.8.0_181 (Oracle Corporation)"
)
@Component
public class UsuarioMapperImpl implements UsuarioMapper {
@Override
public Usuario toEntity(UsuarioSalvarDTO usuarioSalvarDTO) {
if ( usuarioSalvarDTO == null ) {
return null;
}
Usuario usuario = new Usuario();
usuario.setEmail( usuarioSalvarDTO.getEmail() );
usuario.setSenha( usuarioSalvarDTO.getSenha() );
usuario.setStatus( usuarioSalvarDTO.getStatus() );
return usuario;
}
}
When i try to run the test, he gives the following error:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'br.com.financeiroAdam.demo.MapperTests': Unsatisfied dependency expressed through field 'usuarioMapper'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'br.com.financeiroAdam.demo.mapper.UsuarioMapper' available: expected at least 1 bean which qualifies as autowire candidate.
@Autowire in MapperTest don't work. It claims: 'Could not autowire. No beans of 'UsuarioMapper' type found.'
Already tried:
- gradle build (no errors)
- gradle build -x test (no errors)
- Invalidate Caches / Restart
- Re-import project
Using:
- IntelliJ
- Gradle
- Spring
- Lombok
build.gradle
buildscript {
ext {
springBootVersion = '2.1.0.RELEASE'
}
repositories {
mavenCentral()
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
plugins {
id 'net.ltgt.apt' version '0.8'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
group = 'br.com.financeiroAdam'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
implementation('org.springframework.boot:spring-boot-starter-data-jpa')
implementation('org.springframework.boot:spring-boot-starter-web')
compileOnly('org.projectlombok:lombok:1.18.2')
compile 'org.mapstruct:mapstruct-jdk8:1.2.0.Final'
testImplementation('org.springframework.boot:spring-boot-starter-test')
apt('org.projectlombok:lombok:1.18.2')
apt('org.mapstruct:mapstruct-processor:1.2.0.Final')
}
Tried everything. I think the mapstruct simply does not want to work.
Any solutions?
java spring mapstruct
java spring mapstruct
asked Nov 24 '18 at 3:20
DaMewsDaMews
1
1
Hello, could you try the solution in stackoverflow.com/a/52884637/4611077 .
– DonatasD
Nov 24 '18 at 4:34
In addition to the remark of @DonatasD above: MapStruct is a code generator. If the code is not there when your tests execute, there's nothing to autowire
– Sjaak
Nov 24 '18 at 10:46
@DonatasD still dont finding bean of type UsuarioMapper on Autowire
– DaMews
Nov 24 '18 at 10:54
@sjaak But the Impl class is generated. How Autowire cannot find it?
– DaMews
Nov 24 '18 at 10:55
add a comment |
Hello, could you try the solution in stackoverflow.com/a/52884637/4611077 .
– DonatasD
Nov 24 '18 at 4:34
In addition to the remark of @DonatasD above: MapStruct is a code generator. If the code is not there when your tests execute, there's nothing to autowire
– Sjaak
Nov 24 '18 at 10:46
@DonatasD still dont finding bean of type UsuarioMapper on Autowire
– DaMews
Nov 24 '18 at 10:54
@sjaak But the Impl class is generated. How Autowire cannot find it?
– DaMews
Nov 24 '18 at 10:55
Hello, could you try the solution in stackoverflow.com/a/52884637/4611077 .
– DonatasD
Nov 24 '18 at 4:34
Hello, could you try the solution in stackoverflow.com/a/52884637/4611077 .
– DonatasD
Nov 24 '18 at 4:34
In addition to the remark of @DonatasD above: MapStruct is a code generator. If the code is not there when your tests execute, there's nothing to autowire
– Sjaak
Nov 24 '18 at 10:46
In addition to the remark of @DonatasD above: MapStruct is a code generator. If the code is not there when your tests execute, there's nothing to autowire
– Sjaak
Nov 24 '18 at 10:46
@DonatasD still dont finding bean of type UsuarioMapper on Autowire
– DaMews
Nov 24 '18 at 10:54
@DonatasD still dont finding bean of type UsuarioMapper on Autowire
– DaMews
Nov 24 '18 at 10:54
@sjaak But the Impl class is generated. How Autowire cannot find it?
– DaMews
Nov 24 '18 at 10:55
@sjaak But the Impl class is generated. How Autowire cannot find it?
– DaMews
Nov 24 '18 at 10:55
add a comment |
1 Answer
1
active
oldest
votes
//Use @Mock instead of @Autowired
@Mock
private UsuarioMapper usuarioMapper;
//In test method use the below
Mockito.doReturn(info).when(usuarioMapper).XYXMethod(ArgumentMatchers.argThat(t24InfoMatcher));
While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context.
– Robert Columbia
Nov 25 '18 at 23:50
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454892%2ferror-creating-mapstruct-bean-with-spring%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
//Use @Mock instead of @Autowired
@Mock
private UsuarioMapper usuarioMapper;
//In test method use the below
Mockito.doReturn(info).when(usuarioMapper).XYXMethod(ArgumentMatchers.argThat(t24InfoMatcher));
While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context.
– Robert Columbia
Nov 25 '18 at 23:50
add a comment |
//Use @Mock instead of @Autowired
@Mock
private UsuarioMapper usuarioMapper;
//In test method use the below
Mockito.doReturn(info).when(usuarioMapper).XYXMethod(ArgumentMatchers.argThat(t24InfoMatcher));
While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context.
– Robert Columbia
Nov 25 '18 at 23:50
add a comment |
//Use @Mock instead of @Autowired
@Mock
private UsuarioMapper usuarioMapper;
//In test method use the below
Mockito.doReturn(info).when(usuarioMapper).XYXMethod(ArgumentMatchers.argThat(t24InfoMatcher));
//Use @Mock instead of @Autowired
@Mock
private UsuarioMapper usuarioMapper;
//In test method use the below
Mockito.doReturn(info).when(usuarioMapper).XYXMethod(ArgumentMatchers.argThat(t24InfoMatcher));
answered Nov 25 '18 at 17:31
Roshan OswalRoshan Oswal
111
111
While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context.
– Robert Columbia
Nov 25 '18 at 23:50
add a comment |
While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context.
– Robert Columbia
Nov 25 '18 at 23:50
While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context.
– Robert Columbia
Nov 25 '18 at 23:50
While this code may answer the question, it is better to explain how to solve the problem and provide the code as an example or reference. Code-only answers can be confusing and lack context.
– Robert Columbia
Nov 25 '18 at 23:50
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454892%2ferror-creating-mapstruct-bean-with-spring%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Hello, could you try the solution in stackoverflow.com/a/52884637/4611077 .
– DonatasD
Nov 24 '18 at 4:34
In addition to the remark of @DonatasD above: MapStruct is a code generator. If the code is not there when your tests execute, there's nothing to autowire
– Sjaak
Nov 24 '18 at 10:46
@DonatasD still dont finding bean of type UsuarioMapper on Autowire
– DaMews
Nov 24 '18 at 10:54
@sjaak But the Impl class is generated. How Autowire cannot find it?
– DaMews
Nov 24 '18 at 10:55