Setting the @component bean name in mapstruct mapper

Viewed 1212

I know I can create a mapper like this:

@Mapper(componentModel="spring")
public interface MyMapper{

That will result in:

@Component
public class MyMapperImpl{

How can I set the bean name obtaining:

@Component("name")
public class MyMapperImpl{
1 Answers

This is currently not supported. This is issue mapstruct/mapstruct#1427 requested for this feature.

Depending on how your name should look like you can use a custom AnnotationBeanNameGenerator to generate the mappers that are component scanned.

Related