1
|
|
2
|
(참고) Spring Boot 프로젝트 생성 순서
|
3
|
|
4
|
1. Spring Initializr ( https://start.spring.io ) 연결 및 기본 설정
|
5
|
* Project: Maven
|
6
|
* Language: Java
|
7
|
* Spring Boot: 3.4.3 (3.0.x 선택 시 JDK 17 이상 필요)
|
8
|
* Project Metadata
|
9
|
- Group: deu.se
|
10
|
- Artifact: demo (--> ood)
|
11
|
- Description: 데모 프로젝트 (--> 4학년 객체지향설계 교재 내용)
|
12
|
- Packagin: War
|
13
|
- Java: 21
|
14
|
|
15
|
2. 의존성 추가: Spring Boot DevTools, Lombok, Spring Web
|
16
|
|
17
|
3. NetBeans에서 임포트할 demo.zip (--> ood.zip) 파일 다운로드 (하단의 GENERATE 선택)
|
18
|
|
19
|
4. NetBeans IDE에서 demo (--> ood) 프로젝트 생성: demo.zip (--> ood.zip) 파일 임포트
|
20
|
|
21
|
5. pom.xml에 필요한 기본 의존성 추가
|
22
|
* tomcat-embed-jasper
|
23
|
* servelt.jstl
|
24
|
|
25
|
<!-- embedded tomcat과 JSTL 관련 의존성 -->
|
26
|
<!-- 240102 LJM: begin -->
|
27
|
<dependency>
|
28
|
<groupId>org.apache.tomcat.embed</groupId>
|
29
|
<artifactId>tomcat-embed-jasper</artifactId>
|
30
|
</dependency>
|
31
|
<dependency>
|
32
|
<groupId>jakarta.servlet</groupId>
|
33
|
<artifactId>jakarta.servlet-api</artifactId>
|
34
|
</dependency>
|
35
|
<dependency>
|
36
|
<groupId>org.glassfish.web</groupId>
|
37
|
<artifactId>jakarta.servlet.jsp.jstl</artifactId>
|
38
|
</dependency>
|
39
|
<dependency>
|
40
|
<groupId>jakarta.servlet.jsp.jstl</groupId>
|
41
|
<artifactId>jakarta.servlet.jsp.jstl-api</artifactId>
|
42
|
</dependency>
|
43
|
<!-- 240102 LJM: end -->
|
44
|
|
45
|
|
46
|
6. application.properties 환경 설정: 강의 자료 참고
|
47
|
* 뷰 관련 정보
|
48
|
* 서버 포트 및 context-path 정보
|
49
|
* 로깅 수준
|
50
|
|
51
|
# https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html
|
52
|
spring.mvc.view.prefix=/WEB-INF/views/
|
53
|
spring.mvc.view.suffix=.jsp
|
54
|
|
55
|
# https://linkeverything.github.io/springboot/spring-context-path/
|
56
|
server.port=8088
|
57
|
server.servlet.context-path=/demo
|
58
|
# Session timeout. If a duration suffix is not specified, seconds will be used.
|
59
|
server.servlet.session.timeout=3600
|
60
|
|
61
|
# 원하는 패키지의 로깅 수준 설정 가능
|
62
|
logging.level=debug
|
63
|
logging.level.deu.se.ood=debug
|
64
|
|
65
|
|
66
|
|
67
|
|
68
|
7. MVC 패턴에 따라서 필요한 뷰 관련 폴더 생성 후 빌드 (Clean and Build)
|
69
|
* src/main 폴더 아래에 webapp/WEB-INF/views 폴더 생성
|
70
|
|
71
|
8. webapp/WEB-INF/views 폴더 안에 index.jsp (--> project_list.jsp) 추가
|
72
|
|
73
|
9. index.jsp (--> project_list.jsp) 연결할 제어기 클래스 생성: deu.se.demo.SystemController
|
74
|
(--> deu.se.ood.SystemController)
|
75
|
* 클래스 정의 바로 위에 @Controller 추가하여 Spring Boot에서 사용하는 제어기 임을 명시
|
76
|
|
77
|
10. (선택) Run as Spring Boot 액션 메뉴 추가
|
78
|
|
79
|
11. 실행 방법
|
80
|
* NetBeans IDE의 프로젝트 메뉴에서 Run as Spring Boot 선택 또는
|
81
|
* 윈도우 명령 창에서 NetBeans 프로젝트 폴더로 이동 후, mvnw spring-boot:run 입력
|
82
|
|
83
|
|