NullPointerException when trying to define a custom PropertyMap
I'm using ModelMapper the following way : I have a few converter classes that are Spring components and they register custom ModelMapper mappings @Component public class FooConverter { @Autowired private ModelMapper modelMapper; public static final PropertyMap<Foo, FooModel> FOO_TO_FOO_MODEL_MAP = new PropertyMap<Foo, FooModel>() { @Override protected void configure() { map().setTimeZone(source.getTimeZone().getID()); } }; @PostConstruct public void init() { modelMapper.addMappings(FOO_TO_FOO_MODEL_MAP); } } But I get the following error when Spring starts because the configure function gets