Repository navigation
Description
As of now, Mapstruct spring extension(more specifically ConverterRegistrationConfigurationGenerator) generates configuration class with name ConverterRegistrationConfiguration, name of this bean/component is not set, ie defaults to converterRegistrationConfiguration:
@Generated(
value = "org.mapstruct.extensions.spring.converter.ConverterRegistrationConfigurationGenerator",
date = "2025-01-21T08:53:44.800409700Z"
)
@Configuration
class ConverterRegistrationConfiguration {
private final ConfigurableConversionService conversionService;
private final List<Converter<?, ?>> converters;
ConverterRegistrationConfiguration(
@Qualifier("conversionService") final ConfigurableConversionService conversionService,
final List<Converter<?, ?>> converters) {
this.conversionService = conversionService;
this.converters = converters;
}
@PostConstruct
void registerConverters() {
converters.forEach(conversionService::addConverter);
}
}
in my project Mapstruct is used in multiple places: a different set of mappers is implemented for each of them. So 2 different mapstruct related spring configs are defined with pretty much identical content:
package some.package.name1;
...
@Configuration
@ComponentScan("some.package.name1")
@MapperConfig(componentModel = "spring", uses = ConversionServiceAdapter.class)
@SpringMapperConfig(conversionServiceAdapterPackage ="some.package.name1.adapter",
conversionServiceAdapterClassName ="ConversionServiceAdapter",
conversionServiceBeanName = "conversionService",
generateConverterScan = true)
public class MapperSpringConfig1 {
}
and
package some.package.name2;
...
@Configuration
@ComponentScan("some.package.name2")
@MapperConfig(componentModel = "spring", uses = ConversionServiceAdapter.class)
@SpringMapperConfig(conversionServiceAdapterPackage ="some.package.name2.adapter",
conversionServiceAdapterClassName ="ConversionServiceAdapter",
conversionServiceBeanName = "conversionService",
generateConverterScan = true)
public class MapperSpringConfig2 {
}
when application is started I see a conflict between them due to same bean name used in both cases for ConverterRegistrationConfiguration instance:
ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name 'converterRegistrationConfiguration' for bean class [some.package.name1.adapter.ConverterRegistrationConfiguration] conflicts with existing, non-compatible bean definition of same name and class [some.package.name2.adapter.ConverterRegistrationConfiguration]
So I want to propose to provide ability to configure it's class name and bean name(just like it is done for adapter class - conversionServiceAdapterClassName in org.mapstruct.extensions.spring.SpringMapperConfig with default value "ConversionServiceAdapter"), so smth like:
converterRegistrationConfigurationClassName in org.mapstruct.extensions.spring.SpringMapperConfig with default value "ConverterRegistrationConfiguration"
Activity
simonovdenis commentedon Jan 23, 2025
Hello,
I wanted to propose PR with needed changes, but seems I do not have write access to do it. Can you grant me rights to present my changes?
Chessray commentedon Jan 23, 2025
That's quite odd. We've definitely received PRs from others without having to add them to the organisation or repo beforehand. @filiphr Have you got an idea what could be wrong here?
simonovdenis commentedon Jan 24, 2025
On my side I'm receiving error 403, when trying to push my feature branch to remote repository.


As well I don't see in Github web UI green button to create new branch, like on other projects, where I do have access.
mapstruct:
Other project:
Maybe I'm doing something wrong and you have some proper way to create/push branches, create PRs. If so - please share such info with me, please.
Chessray commentedon Jan 24, 2025
Non-members can follow the basic GitHub flow:
mainbranch in your own space.simonovdenis commentedon Jan 28, 2025
@Chessray Thanks for providing an instruction. Opened PR: #121. Please review.
simonovdenis commentedon Feb 18, 2025
@Chessray Do I have to add something else to PR for its successful approval/merge?
simonovdenis commentedon Feb 20, 2025
PR: #121 merged to main. So feature will be available in next release.
BTW is there some info on release schedule?