
[Spring] Mapper, Dao, Service, Controller Sequence
·
Server/Spring&Spring Boot
Sequence 스프링으로 여러 페이지를 제작하면서 작성 순서를 깔끔하게 정리하고 싶어서 작성한 순서입니다. 이미지 1. Mapper MyBatis Mapper에 쿼리를 먼저 작성합니다. 2. Dao Dao에 해당 Mapper를 사용한 메소드를 작성하고 SqlSession을 사용하여 Mapper의 쿼리와 연결합니다. 3. Service Service의 필드에는 Dao가 선언되어 있습니다. Service로 넘어가서 Dao를 연결하는 메소를 작성합니다. 4. Controller Controller의 필드에는 Service가 선언되어 있습니다. Controller로 넘어가서 해당 페이지에 대한 메소드를 작성합니다.