I\'m using ModelMapper the following way :
I have a few converter classes that are Spring components and they register custom ModelMapper mappings
@C
For anyone coming across with the same issue: My problem was that I used PropertyMap with anonymous implementation like the documentation suggested within a spring configuration. This messed up within the ExplicitMappingBuilder. What I have now is the following:
@Configuration
public class ApplicationConfig {
@Bean
public ModelMapper modelMapper() {
ModelMapper modelMapper = new ModelMapper();
modelMapper.addMappings(new UserPropertyMap());
return modelMapper;
}
}
My UserPropertyMap looks like this:
public class UserPropertyMap extends PropertyMap {
@Override
protected void configure() {
map().setUserName(source.getUsername());
}
}
This worked like a charm in Spring Boot 2.