Skip to content

Research Singleton Pattern for the Mapper class DTOEntityMappings #8

@cterse

Description

@cterse

For now, a single ModelMapper instance is being returned from DTOEntitiesMappings class, which performs configuration loading by adding mappings from the defined PropertyMaps list in the class.

It does this every time a new instance of the DTOEntitiesMappings class is called, which seems futile, since each time the same mappings are gettings added to the ModelMapper instance. Also, no new mappings configurations for DTO <-> Entity mapping are expected within the application flow for now.

Try creating a single instance of ModelMapper inside the DTOEntitiesMappings class, instantiate this instance the first time the model mapper is required anywhere in the code, and returned the same instantiated ModelMapper instance thereafter.

Metadata

Metadata

Assignees

Labels

taskImplementation needed with relative priority

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions