본문 바로가기

JAVA

Spring MVC Framework

Spring

Maven 구조 :: pom.xml

  • groupId와 artifactId에는 우리가 지정한 프로젝트 이름이 들어감
  • 앞 두개는 groupId이고 마지막은 artifactId이다.
  • dependencies내부에 dependency들이 존재. dependency하나 당 jar(library)하나.
  • dependency에서는 라이브러리 이름이 artifactId내부에 들어가고, 해당 라이브러리가 포함되어져있는 패키지가 groupId내부에 들어있다.
  • 그렇게 들어있는 라이브러리들을 remote하여 local.m2에 저장src 내부 web.xml

src 내부 web.xml

  • WAS 가동 시 가장 먼저 읽어오는 dd파일이 web.xml이다.
  • web.xml은 servlet-context.xml과 root-context.xml을 wiring한다.
  • servlet-context.xml과 root-context.xml은 bean 설정문서

WAS 가 하는 일

  • Servletcontext생성 및 root-context.xml wiring
  • DispatcherServlet 생성 및 servlet-context.xml wiring

MainController의 역할

  • 실체클래스로 Bean을 가지고 Component이다. 이는 인터페이스 기반으로 작성된 Java Class임.

객체생성

  • WAS와 DI Container가 하는 역할이 객체 생성이다.
  • WAS는 DD파일인 web.xml이 주문서인 반면, DI Container의 경우 servlet-context.xml이 IoC의 역할을 하는 빈 설정문서 즉, 주문서이다.
  • WAS는 Web에서 작성되는 servlet이다.
  • DI Container는 Java Class. 즉, 인터페이스 기반 Component이다.

파란 부분만 우리가 만들면 된다.

 

개발 순서

1. MyBatisFramework

1) DB 설계
2) Item
3) SqlMapConfig
4) ~mapper.xml과 db.properties는 SqlMapConfig와 wiring

2. Business Logic Layer

1) Persistence Layer의 DAO, DAOImpl(@Repository) 제작
2) Service Layer의 Service, ServiceImpl(@Service) 제작

3. Presentation Layer

@Controller

5. Front UI 제작

 

최종 Framework - spring_sp05 참고

 

'JAVA' 카테고리의 다른 글

[Spring Boot] REST 연결  (0) 2021.07.07
Restful Service  (0) 2021.07.05
[JAVA Framework] Spring Framework  (0) 2021.06.23
Java Framework 도입  (0) 2021.06.17