Skip to content

Commit

Permalink
✨ ModelMapper 설정
Browse files Browse the repository at this point in the history
  • Loading branch information
u-genuine committed Jan 19, 2024
1 parent bc068f0 commit 57fdab3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/aromanticcat/umcproject/config/AppConfig.java
Original file line number Diff line number Diff line change
@@ -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;
}
}

0 comments on commit 57fdab3

Please sign in to comment.