Mybatis Configuration

hjkim·2022년 6월 13일
1
PropertyDescription
config-locationMybatis config xml 파일의 위치
check-config-locationMybatis config xml 파일이 존재하는지 체크여부
mapper-locationsMapper.xml 파일의 위치
type-aliases-packageparameterType 또는 resultType 값으로 VO, DTO 클래스들을 넘길 때 패키지 경로까지 모두 써야 하는 불편함을 제거하고자 해당 설정을 통해 VO, DTO가 위치하는 패키지명을 명시. parameterType과 resultType에는 class 명칭만 작성해주면 됨.
type-aliases-super-typetype-aliases-package를 통해 설정된 type-alias 중 걸러내야 하는 class들을 명시. 이 설정이 명시되지 않을 경우, type-aliases-package에 속한 모든 class들을 type alias로 처리함.
type-handlers-packageModel 객체 내에 enum type이 존재하여 해당 값을 조회해오지 못하는 문제가 발생할 수 있어 TypeHandler를 정의해 해결할 수 있음. 이때 TypeHandler의 패키지명을 명시하는 Property.
executor-typeSIMPLE(매 호출마다 statement 생성), REUSE(statementMap이 존재하여 statementMap에 존재하는 statement는 재사용, 존재하지 않는 statement는 생성한 뒤 statementMap에 추가), BATCH(statementList가 존재하여 현재 statement가 맨 마지막에 사용된 statement와 동일할 때에만 statement를 재사용, 예시)
default-scripting-language-drivermybatis-spring 2.0.2+에서 필요로 하는 설정. xml이 아닌 velocity 혹은 그 외의 scripting language로 동적 쿼리를 작성해야 하는 경우 해당 설정을 변경, 예시
configuration-propertiesapplication.properties에 정의해 둔 key-value 값을 사용할 수 있게 해주는 설정 #{}가 아닌 ${}로 접근해야 함. 예시
lazy-initializationMapper bean의 lazy initialization 여부. mybatis-spring 2.0.2+에서 필요로 하는 설정.
mapper-default-scopeMapper bean의 scope를 변경하고자 할 때 사용
mybatis.inject-sql-session-on-mapper-scanSqlSessionTemplate 또는 SqlSessionFactory bean의 주입 여부, spring-native와 함께 사용 중이라면 true(기본값)로 설정되어야 함.
configuration.*Mybatis Core로부터 제공되는 Configuration bean의 속성 설정, map-underscore-to-camel, default-fetch-size, default-statement-timeout 등의 속성 제공. config-location과 함께 사용해서는 안됨.
scripting-language-driver.thymeleaf.*ThymeleeafLanguageDriverConfig bean의 property를 설정하기 위한 configuration
scripting-language-driver.freemarker.*FreeMarkerLanguageDriverConfig bean의 property를 설정하기 위한 configuration
scripting-language-driver.velocity.*VelocityLanguageDriverConfig bean의 property를 설정하기 위한 configuration

[참조] http://mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure

profile
피드백은 언제나 환영입니다! :)

0개의 댓글