728x90
반응형
DB환경은 오라클...
커머스는 대부분 오라클을 사용하는것 같다...
복잡한 DB모델링에 mysql 을 사용하면 인덱싱 문제라던가 마이그레이션 문제시 해결할 수 있는
경험 인력이 부족해서 일지도 모른다...
비용으로 인해 DB를 여러가지 사용하는 프로젝트도 많다...
문제는 복잡하다는거다...
hibernate 를 사용하지 않는 이유는
현재 테스트하기 위한 프로젝트가 그러하기 때문이다.
오래된 개발자들 일수록 DB 쿼리에 익숙한거 같다..
펑션,프로시저,복잡한 쿼리...인라인쿼리(서브,스칼라)는 지양하자...
마이바티스 설정
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 |
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication
@EnableScheduling
@MapperScan("com.idr.*.dao")
public class WebhaApplication {
public static void main(String[] args) {
SpringApplication.run(WebhaApplication.class, args);
}
}
|
@MapperScan("com.idr.*.dao") 는 마이바티스 설정이다.
yml 내용에 아래를 추가한다.
1
2
3
4
5
6 |
mybatis:
mapper-locations: classpath:mapper/*/*.xml
configuration:
lazyLoadingEnabled: true
aggressiveLazyLoading: false
mapUnderscoreToCamelCase: true |
위 루트에 mapper 를 존재하게 한다.
1
2
3
4
5
6
7
8
9
10
11
12
13 |
import java.util.List;
import org.springframework.stereotype.Repository;
import com.webha.user.model.GroupCodeModel;
@Repository
public interface CommonCodeDao {
public List<GroupCodeModel> getCommonCodeList();
}
|
Controller 에는 @Controller 어노테이션
Service 에는 @Service
Dao 파일에 @Repository 을 명시해준다.
[출처] 5. Spring Boot - Mybatis 설정 (웹의 하루) |작성자 뺑이
728x90
반응형
'SPRINGBOOT > 노하우정보' 카테고리의 다른 글
7. Spring Boot - Mapper (0) | 2017.05.29 |
---|---|
6. Spring Boot - Template Engine (0) | 2017.05.29 |
4. Spring Boot - yml 설정 (0) | 2017.05.29 |
3. Spring Boot - Gradle 설정 (0) | 2017.05.29 |
2. Spring Boot - 프로젝트 생성 (0) | 2017.05.29 |
1. Spring Boot - 이클립스 세팅 (0) | 2017.05.29 |