RootConfig > SPRING_DATA_JPA

본문 바로가기

사이트 내 전체검색

뒤로가기 SPRING_DATA_JPA

RootConfig

페이지 정보

작성자 관리자 작성일 24-06-17 14:25 조회 1,186 댓글 0

본문

189200eb490bf43b9e5d4af61a328371_1718601960_0394.png
 



package web.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 RootConfig {


@Bean

public ModelMapper getMapper() {

ModelMapper modelMapper = new ModelMapper();


modelMapper.getConfiguration()

.setFieldMatchingEnabled(true)

.setFieldAccessLevel(org.modelmapper.config.Configuration.AccessLevel.PRIVATE)

.setMatchingStrategy(MatchingStrategies.LOOSE);


return modelMapper;

}

}





[설명]
@Configuration을 이용해서 해당 클래스가 스프링의 설정 클래스임을 명시하고 ModelMapper를 스프링의 빈으로 설정한다.
@Bean을 이용

댓글목록 0

등록된 댓글이 없습니다.


Copyright © dancePKT. All rights reserved.
PC 버전으로 보기