tisispa1
tisispa1

Reputation: 233

Consider defining a bean of type 'Mapper' in your configuration mapstruct

In my spring boot project i was using matstruct library for transform the DTO's , i followed the same all approach showed in demo code from internet. but unfortunately facing below issue.

Not sure what is real issue here,

Note : This issue only occurs in STS, Eclipse if suppose i used latest IntelliJ its working fine !

@Service 
    public class SomeService {
    
    @Autowired
    MyCustomMapper myCustomMapper ;
    
    //some code 
}

here i already created a interface for mapper class and defined as

(componentModel = "spring")

@Mapper(componentModel = "spring")
public interface MyCustomMapper {
    List<TestVo> selectTest();
}

But its throwing below error

Description :
Parameter 3 of constructor in com.xxx.xxxx.service.SomeService required a bean of type 'com.xxx.xxxx.xxx.MyCustomMapper' that could not be found.



Action:

Consider defining a bean of type 'com.xxx.xxxx.xxx.MyCustomMapper' in your configuration.

Already added the dependecy like below in build.gradle aswell

implementation 'org.mapstruct:mapstruct:1.5.5.Final'
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.5.Final'

My suspicion was its generating mapper implementation classes for the mapper , but STS & Eclipse are not picking those files by default ! Any help will be appreciated Thanks in advance !

Upvotes: 0

Views: 224

Answers (0)

Related Questions