diff --git a/build.gradle b/build.gradle index 95d364e..acaf9e0 100644 --- a/build.gradle +++ b/build.gradle @@ -34,6 +34,9 @@ dependencies { implementation 'org.springdoc:springdoc-openapi-ui:1.6.15' implementation 'io.springfox:springfox-swagger2:2.9.2' implementation 'io.springfox:springfox-swagger-ui:2.9.2' + + // model mapper + implementation 'org.modelmapper:modelmapper:3.1.0' } tasks.named('test') { diff --git a/src/main/java/aromanticcat/umcproject/config/AppConfig.java b/src/main/java/aromanticcat/umcproject/config/AppConfig.java new file mode 100644 index 0000000..a764755 --- /dev/null +++ b/src/main/java/aromanticcat/umcproject/config/AppConfig.java @@ -0,0 +1,21 @@ +package aromanticcat.umcproject.config; + +import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class AppConfig { + + @Bean + public ModelMapper getMapper(){ + ModelMapper modelMapper = new ModelMapper(); + modelMapper.getConfiguration() + .setFieldMatchingEnabled(true) + .setFieldAccessLevel(org.modelmapper.config.Configuration.AccessLevel.PRIVATE) + .setMatchingStrategy(MatchingStrategies.STRICT); + + return modelMapper; + } +}