Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rosieoh/springframework_study

๐ŸŒˆ์ฒœ์žฌ๊ต์œก ํ’€์Šคํƒ JAVA ๊ณผ์ • 2๊ธฐ Spring Framework ๐ŸŒˆ
https://github.com/rosieoh/springframework_study

aop hibernate java jpa spring

Last synced: 10 days ago
JSON representation

๐ŸŒˆ์ฒœ์žฌ๊ต์œก ํ’€์Šคํƒ JAVA ๊ณผ์ • 2๊ธฐ Spring Framework ๐ŸŒˆ

Awesome Lists containing this project

README

        

# 01. Spring Framework ๊ฐœ์š”


## 01-01. Spring ์—ญ์‚ฌ
- EJB๋ฅผ ์ฃผ ํ”„๋ ˆ์ž„์›Œํฌ๋กœ ์‚ฌ์šฉํ•  ๋•Œ ๋ถˆํŽธํ–ˆ๋˜ ์ ๋“ค(๋ฌด๊ฑฐ์›€, ๋”ฐ๋ผ์•ผ ํ•  ์ŠคํŽ™๋“ค์ด ๋ณต์žกํ•จ)์„ ํ•ด์†Œํ•˜๊ธฐ ์œ„ํ•ด ํƒ„์ƒํ•จ
- 2002๋…„ ๋กœ๋“œ์กด์Šจ์ด ์ถœํŒํ•œ ๋„์„œ Expert One-on-One J2EE Design and Development์— ์„ ๋ณด์ธ ์ฝ”๋“œ๊ฐ€ ํ˜„์žฌ Spring์˜ ๊ทผ๊ฐ„์ด ๋จ
- ์ด ๋„์„œ๋ฅผ ์ฝ์€ ๊ฐœ๋ฐœ์ž๋“ค์ด '์ฝ”๋“œ๊ฐ€ ์ฑ…์œผ๋กœ๋งŒ ์กด์žฌํ•˜๊ธฐ์—๋Š” ๋„ˆ๋ฌด ์•„๊น๋‹ค'๋ผ๋ฉฐ ๋กœ๋“œ ์กด์Šจ์˜ ํ—ˆ๊ฐ€๋ฅผ ๋ฐ›์€ ๋’ค ํ”„๋ ˆ์ž„์›Œํฌ๋กœ ๋ฐœ์ „์‹œํ‚ด
- 2003๋…„ 6์›” Apache 2.0 License๋กœ ๊ณต๊ฐœ๋จ
- 2004๋…„์— 1.0v์ด ๋ฐฐํฌ๋จ


## 01-02. Spring Framework๋ž€?
- ์ž๋ฐ”, ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ๊ฐœ๋ฐœ, ์˜คํ”ˆ์†Œ์Šค, light-weigth "์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ํ”„๋ ˆ์ž„์›Œํฌ"์ด๋‹ค.
- ํŠน์ • ๊ณ„์ธต์ด๋‚˜ ๊ธฐ์ˆ , ์—…๋ฌด ๋ถ„์•ผ์— ๊ตญํ•œ๋˜์ง€ ์•Š๊ณ  ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ์ „ ์˜์—ญ์„ ํฌ๊ด„ํ•˜๋Š” ๋ฒ”์šฉ์ ์ธ ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ๋งํ•จ.
- ๊ต‰์žฅํžˆ ๋ฒ”์šฉ์ ์ด๊ณ  ๋‹ค์–‘ํ•œ ๋ถ„์•ผ์—์„œ ํ™œ์šฉํ•˜๊ณ  ์žˆ์ง€๋งŒ, ๋ชจ๋‘ ๋‹ค ์•Œ์•„์•ผ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๊ฒƒ์€ ์•„๋‹Œ ๋งŒํผ ๊ธฐ๋ณธ์— ์ถฉ์‹คํ•ด์„œ ํ•™์Šตํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

### 1) ๊ฒฝ๋Ÿ‰๊ธ‰ ํ”„๋ ˆ์ž„์›Œํฌ
- ๋‹จ์ˆœํ•œ ์›น ์ปจํ…Œ์ด๋„ˆ์—์„œ๋„ ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ๊ฐœ๋ฐœ์˜ ๊ณ ๊ธ‰๊ธฐ์ˆ ์„ ๋Œ€๋ถ€๋ถ„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
- EJB์— ๋น„ํ•ด ๊ฒฝ๋Ÿ‰๊ธ‰์ž…๋‹ˆ๋‹ค. ๋˜ํ•œ ์ผ๋ฐ˜ ์ž๋ฐ” ๊ฐ์ฒด๋งŒ์„ ์‚ฌ์šฉํ•˜์—ฌ ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ๊ธ‰์˜ ๊ณ ๊ธ‰ ๊ธฐ์ˆ ์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

### 2) ์—”ํ„ฐํ”„๋ผ์ด์ฆˆ ๊ฐœ๋ฐœ ์šฉ์ด
- ๊ฐœ๋ฐœ์ž๊ฐ€ ๋ณต์žกํ•˜๊ณ  ์‹ค์ˆ˜ํ•˜๊ธฐ ์‰ฌ์šด Low Level์— ๋งŽ์ด ์‹ ๊ฒฝ ์“ฐ์ง€ ์•Š์œผ๋ฉด์„œ Business Logic ๊ฐœ๋ฐœ์— ์ „๋…ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค๋‹ˆ๋‹ค.

### 3) ์˜คํ”ˆ์†Œ์Šค
- Spring์€ OpenSource ๋กœ์„œ ๋ˆ„๊ตฌ๋‚˜ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋‹ค๋งŒ, ์•„๋ฌด๋‚˜ ์ž˜ ํ•˜๋Š” ๊ฒƒ์€ ์•„๋‹ˆ๋ฉฐ, ๋ฌด๋ฃŒ ํ”„๋ ˆ์ž„์›Œํฌ์˜ ๋‹จ์ ์„ ๊ทน๋ณตํ•˜๊ณ , ์žฅ์ ์„ ๊ทน๋Œ€ํ™”ํ•˜์—ฌ ์‚ฌ์šฉํ•˜์—ฌํ•˜์—ฌ ํ•ฉ๋‹ˆ๋‹ค.


## 01-03. Spring Framework ํŠน์ง•
### 1) ์ปจํ…Œ์ด๋„ˆ ์ œ๊ณต
- Spring ์ปจํ…Œ์ด๋„ˆ(Container)๋Š” Java ๊ฐ์ฒด์˜ Life Cycle์„ ๊ด€๋ฆฌํ•˜๋ฉฐ, Spring ์ปจํ…Œ์ด๋„ˆ(Container)๋กœ๋ถ€ํ„ฐ ํ•„์š”ํ•œ ๊ฐ์ฒด๋ฅผ ๊ฐ€์ ธ์™€ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

### 2) DI(Dependency Injection) ์ง€์›
- Spring์€ ์„ค์ • ํŒŒ์ผ์ด๋‚˜ ์–ด๋…ธํ…Œ์ด์…˜(Annotation)์„ ํ†ตํ•ด์„œ ๊ฐ์ฒด ๊ฐ„์˜ ์˜์กด๊ด€๊ณ„๋ฅผ ์„ค์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค.

### 3) AOP(Aspect Oriented Programming) ์ง€์›
- Spring์€ ํŠธ๋žœ์žญ์…˜(Transaction)์ด๋‚˜ ๋กœ๊น…(Logging), ๋ณด์•ˆ(Security)๊ณผ ๊ฐ™์ด ๊ณตํ†ต์ ์œผ๋กœ ํ•„์š”๋กœ ํ•˜๋Š” ๋ชจ๋“ˆ๋“ค์„ ์‹ค์ œ ํ•ต์‹ฌ ๋ชจ๋“ˆ์—์„œ ๋ถ„๋ฆฌํ•ด์„œ ์ ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

### 4) POJO(Plain Old Java Object) ์ง€์›
- Sring ์ปจํ…Œ์ด๋„ˆ(Container)์— ์ €์žฅ๋˜๋Š” Java๊ฐ์ฒด๋Š” ํŠน์ •ํ•œ ์ธํ„ฐํŽ˜์ด์Šค(Interface)๋ฅผ ๊ตฌํ˜„ํ•˜๊ฑฐ๋‚˜, ํŠน์ • ํด๋ž˜์Šค(Class)๋ฅผ ์ƒ์†๋ฐ›์ง€ ์•Š์•„๋„ ๋ฉ๋‹ˆ๋‹ค.

### 5) ํŠธ๋žœ์žญ์…˜(Transaction) ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ์ผ๊ด€๋œ ๋ฐฉ๋ฒ•์„ ์ง€์›
- JDBC(Java DataBase Connectivity), JTA(Java Transaction API) ๋“ฑ ์–ด๋–ค ํŠธ๋žœ์žญ์…˜์„ ์‚ฌ์šฉํ•˜๋”๋ผ๋„ ์„ค์ •(Configuration)์„ ํ†ตํ•ด ์ •๋ณด๋ฅผ ๊ด€๋ฆฌํ•˜๋ฏ€๋กœ ํŠธ๋žœ์žญ์…˜ ๊ตฌํ˜„์— ์ƒ๊ด€์—†์ด ๋™์ผํ•œ ์ฝ”๋“œ๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

### 6) ์˜์†์„ฑ(Persistence)๊ณผ ๊ด€๋ จ๋œ ๋‹ค์–‘ํ•œ API ์ง€์›
- Spring์€ Mybatis, Hibernate ๋“ฑ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ฒ˜๋ฆฌ๋ฅผ ์œ„ํ•œ ORM(Object Relational Mapping) ํ”„๋ ˆ์ž„์›Œํฌ๋“ค๊ณผ์˜ ์—ฐ๋™ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.


## 01-04. Spring Framework ์ฃผ์š” ๋ชจ๋“ˆ ๊ตฌ์„ฑ

![Spring Framework ์ฃผ์š” ๋ชจ๋“ˆ ๊ตฌ์„ฑ](./springframework001.png)

### 1) Data Access/Integration(๋ฐ์ดํ„ฐ ์ ‘๊ทผ ๋ฐ ํ†ตํ•ฉ)

JDBC(Java DataBase Connectivity) : Java ๊ธฐ๋ฐ˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์ €์žฅ ๋ฐ ์—…๋ฐ์ดํŠธํ•˜๊ฑฐ๋‚˜, ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์— ์ €์žฅ๋œ ๋ฐ์ดํ„ฐ๋ฅผ Java์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ์ž๋ฐ” API์ž…๋‹ˆ๋‹ค.

ORM(Object Relational Mpping) : ๊ฐ์ฒด์™€ ๊ด€๊ณ„ํ˜• ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์˜ ๋ฐ์ดํ„ฐ๋ฅผ ์ž๋™์œผ๋กœ ๋งคํ•‘(์—ฐ๊ฒฐ)ํ•ด์ฃผ๋Š” ๊ฒƒ์„ ๋งํ•ฉ๋‹ˆ๋‹ค.

OXM(Object-XML Mapping) : XML๊ณผ ์ž๋ฐ”(Java) ์˜ค๋ธŒ์ ํŠธ๋ฅผ ๋งคํ•‘ํ•ด์„œ ์ƒํ˜ธ ๋ณ€ํ™˜ํ•ด์ฃผ๋Š” ๊ธฐ์ˆ ์ž…๋‹ˆ๋‹ค.

JMS(Java Message Service) : ์‚ฌ๋žŒ์ด ์•„๋‹Œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์˜ ๊ตฌ์„ฑ ์š”์†Œ๊ฐ€ ์†Œ๋น„ํ•˜๋Š” ์š”์ฒญ, ๋ณด๊ณ ์„œ, ์ด๋ฒคํŠธ๋กœ ๋ฉ”์‹œ์ง€๋ฅผ ์ž‘์„ฑ, ์ „์†ก ์ˆ˜์‹  ๋ฐ ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ๋ฉ”์‹œ์ง• ์„œ๋น„์Šค๋ฅผ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์„ ๋งํ•ฉ๋‹ˆ๋‹ค.

Transactions : ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค์—์„œ ์—ฌ๋Ÿฌ ์š”์ฒญ์ด ํ•œ ๊บผ๋ฒˆ์— ์ฒ˜๋ฆฌ๊ฐ€ ๋˜์–ด์•ผ ํ•˜๋Š” ํŠธ๋žœ์žญ์…˜(Transaction)์ด ์ •์˜๋˜๊ณ , ๊ตฌํ˜„๋  ์ˆ˜ ์žˆ๋„๋ก ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.


### 2) Web
- Websocket : HTTP ํ†ต์‹ ์˜ ๋‹จ์ ์ธ ๋‹จ๋ฐฉํ–ฅ ํ†ต์‹ ์„ ๊ฐœ์„ ํ•˜๊ธฐ ์œ„ํ•˜์—ฌ ์›น ์†Œ์ผ“์„ ํ™œ์šฉํ•˜์—ฌ ๋ฐ˜ ์˜๊ตฌ์ ์ธ ์–‘๋ฐฉํ–ฅ ํ†ต์‹ ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
- Servlet : MVC ์ฒ˜๋ฆฌ ํŒจํ„ด์—์„œ Controller์— ํ•ด๋‹นํ•˜๋Š” ์š”์ฒญ์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ ์ž‘์—…์ด ์ง„ํ–‰๋˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค.
- Web : JSP(Java Server Page)์— ์†ํ•˜๋Š” Expression, Directive, Declaration, Expression Language, Java Standard Tag Library ๋“ฑ์„ ํ™œ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์›น ๋ชจ๋“ˆ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
- Portlet : ํฌํ„ธ ํŽ˜์ด์ง€๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์›น ์ปดํฌ๋„ŒํŠธ(Web Component)๋ฅผ ์ œ๊ณตํ•˜๋ฉฐ, ๋˜ํ•œ, MVC ์ฒ˜๋ฆฌ ํŒจํ„ด์—์„œ View ์†ํ•˜๋Š” ๊ณณ์— ๋ฐ์ดํ„ฐ๋ฅผ ์ฒ˜๋ฆฌํ•˜์—ฌ ๋ณด๋‚ด ์งˆ ์ˆ˜ ์žˆ๋Š” ์—ญํ• ์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.


### 3) Core Container
- ์ฃผ์š”ํ•œ ๊ฐ์ฒด๋“ค(Bean)์„ ๊ด€๋ฆฌํ•ด์ฃผ๋Š” ์•„์ฃผ ์ค‘์š”ํ•œ ๋ชจ๋“ˆ
- Beans : ์Šคํ”„๋ง ์ปจํ…Œ์ด๋„ˆ์— ์˜ํ•ด ๊ด€๋ฆฌ๋˜๋Š” ์žฌ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ์†Œํ”„ํŠธ์›จ์–ด ์ปดํฌ๋„ŒํŠธ๋กœ์„œ ํ•˜๋‚˜์˜ ํด๋ž˜์Šค๋กœ ๋ถ€ํ„ฐ ์–ป์–ด์ง„ ๊ฐ์ฒด์ด๋ฉฐ, ์ฃผ์ž…(Inject)์˜ ๋Œ€์ƒ์ž…๋‹ˆ๋‹ค. XML์˜ bean ํƒœ๊ทธ๋‚˜ @Configuration ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ ์„ค์ •๋˜๋Š” ์ฃผ์ž… ์„ค์ • ํด๋ž˜์Šค์—์„œ @Bean ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ ์„ค์ •๋ฉ๋‹ˆ๋‹ค.
- Core : ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ์˜ ๊ทผ๊ฐ„์ด ๋˜๋Š” ์š”์†Œ๋กœ IoC(Invert Of Control) ๋˜๋Š” DI(Dependency Injection)๊ธฐ๋Šฅ์„ ์ง€์›ํ•˜๋Š” ์š”์†Œ์ž…๋‹ˆ๋‹ค.
- Context : ์—ฌ๋Ÿฌ Bean์„ ๊ด€๋ จ์žˆ๋Š” ์š”์†Œ๋กœ ๊ฐ ๊ฐ ๋ถ„๋ฆฌํ•˜์—ฌ ํ•˜๋‚˜์˜ XML ํŒŒ์ผ๋กœ ๊ตฌ์„ฑ๋  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ์š”์†Œ์ž…๋‹ˆ๋‹ค.
- SpEL : Spring Expresion Language์˜ ์•ฝ์ž๋กœ ๋Ÿฐํƒ€์ž„(์‹คํ–‰) ์‹œ ๊ฐ์ฒด ๊ทธ๋ž˜ํ”„ ์ฟผ๋ฆฌ ๋ฐ ์กฐ์ž‘์„ ์ง€์›ํ•˜๋Š” ํ‘œํ˜„ ์–ธ์–ด๋กœ์„œ #{ํ‘œํ˜„์‹} ์ด๋‚˜ ${ํ‘œํ˜„์‹} ์œผ๋กœ๋œ ํŒŒ๋ผ๋ฏธํ„ฐ๋‚˜ ์—ฐ์‚ฐ์‹, ๋น„๊ต์‹ ๋“ฑ์„ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋•์Šต๋‹ˆ๋‹ค.

### 4) Test
- JUnit ๋ฐ Spring Test ๋ฅผ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
- JUnit์€ @Test, @Ignore, @Before, @After, @BeforeClass, @AfterClass ๋“ฑ์˜ ์–ด๋…ธํ…Œ์ด์…˜์„ ํ™œ์šฉํ•œ assert ๋ฉ”์„œ๋“œ๋กœ ๋‹จ์œ„ ํ…Œ์ŠคํŠธ ํ”„๋ ˆ์ž„์„ ๊ตฌ์„ฑ์„ ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.
- Spring Test๋Š” @RunWith, @ContextConfiguration, @Autowired ์–ด๋…ธํ…Œ์ด์…˜์„ ํ™œ์šฉํ•˜์—ฌ ๋ณ„๋„์˜ ์ปจํ…์ŠคํŠธ ์—†์ด๋„ ํ…Œ์ŠคํŠธ ์ผ€์ด์Šค๋ฅผ ์ž‘์„ฑํ•  ์ˆ˜ ์žˆ๋„๋ก ์ง€์›ํ•ฉ๋‹ˆ๋‹ค.

### 5) Spring Object
- AOP(Aspect-Oriented Programming) : ๊ณตํ†ต์ ์œผ๋กœ ์ ์šฉ์ด ๋˜์–ด์•ผ ํ•˜๋Š” ๋ถ€๋ถ„์ด ์—ฌ๋Ÿฌ ๊ตฐ๋ฐ์— ํฉ์–ด์ ธ ์žˆ์„ ๊ฒฝ์šฐ ์‚ฌ์šฉ์‹œ๊ธฐ(Jointpoint)๊ฐ€ ๋˜์—ˆ์„ ๊ฒฝ์šฐ ๋Œ€๋น„ํ•ด ์—ฌ๋Ÿฌ ์‚ฌ์šฉ์‹œ๊ธฐ(Jointpoint)๋ฅผ ์ •๊ทœ ํ‘œํ˜„์‹์ธ ํฌ์ธํŠธ์ปท(Pointcut)์œผ๋กœ ๋งŒ๋“ค์–ด ๊ฐ ๊ฐ์˜ ๋Œ€์ƒ ํด๋ž˜์Šค์— ์žˆ๋Š” ์ฝ”๋“œ๋ฅผ ์—ฐ๊ฒฐํ•˜์—ฌ ํ•˜๋‚˜์˜ ๊ฐ์ฒด๋กœ ๋งŒ๋“œ๋Š”๋ฐ ์ด๋ฅผ ์œ„๋น™(Weaving)์ด๋ผ ํ•˜๊ณ , ์œ„๋น™(Weaving) ๋œ ๊ฒƒ์„ ๋™์ž‘๋˜๋„๋ก ํ•ฉ๋‹ˆ๋‹ค. ์ด ๋•Œ ์œ„๋น™(Weaving)๋œ ๋™์ž‘์„ ์–ด๋“œ๋ฐ”์ด์Šค(Advice)๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
- Aspects : ๋ณดํ†ต AspectJ์— ์˜ํ•œ ๊ด€์ ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ์˜๋ฏธํ•˜๋ฉฐ, Spring AOP๋Š” ๊ณตํ†ต์ ์ธ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ„๋‹จํžˆ ๊ตฌํ˜„ํ•˜๊ณ , Spring Container์— ์˜ํ•ด ๊ด€๋ฆฌ๋˜๋Š” Bean์—๋งŒ ์ ์šฉํ•˜์ง€๋งŒ, Aspects๋Š” Spring AOP๋ณด๋‹ค ๊ฐ•๋ ฅํ•˜๊ณ , ์™„์ „์ฒด๋ฅผ ๋ณ„๋„๋กœ ๊ตฌ์„ฑํ•˜์—ฌ ์ง„ํ–‰ํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋งŽ์ด ๋ณต์žกํ•ด์ง‘๋‹ˆ๋‹ค.
- Instrumentation : ๋นˆ์˜ ์ƒ๋ช…์ฃผ๊ธฐ์™€ ์„ค์ • ๊ทธ๋ฆฌ๊ณ  ์ฒ˜๋ฆฌ๋ฐฉ๋ฒ•์„ ๊ด€๋ฆฌํ•˜๋Š” ์Šคํ”„๋ง ์ปจํ…Œ์ด๋„ˆ์ž…๋‹ˆ๋‹ค.
- Messaging : ์‹œ์Šคํ…œ์˜ ๊ตฌ์„ฑ ์š”์†Œ ๊ฐ„์— ๋ฉ”์‹œ์ง•์„ ์ง€์›ํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๋Š” ์š”์†Œ์ž…๋‹ˆ๋‹ค.


## 01-05. Spring Framework ์˜ ๊ฐœ๋ฐœํ™˜๊ฒฝ ์„ค์ •

### 1) Open JDK ์„ค์น˜

https://www.azul.com/downloads/?package=jdk#zulu

์œ„ ์‚ฌ์ดํŠธ์— ์ ‘์†ํ•˜์—ฌ Open JDK 17 ๋ฒ„์ „์˜ Windows
x86 64-bit์šฉ์œผ๋กœ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์€ ํ›„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

![OpenJDK 17 ์„ค์น˜](./capture/setting00_01.png)

### 2) ์ธํ…”๋ฆฌ์ œ์ด ์„ค์น˜

https://www.jetbrains.com/ko-kr/idea/download/?section=windows

์œ„ ์‚ฌ์ดํŠธ์— ์ ‘์†ํ•˜์—ฌ ์ธํ…”๋ฆฌ ์ œ์ด๋ฅผ ๋‹ค์šด๋กœ๋“œ ๋ฐ›์•„ ์„ค์น˜ํ•ฉ๋‹ˆ๋‹ค.

![์ธํ…”๋ฆฌ์ œ์ด ์„ค์น˜](./capture/setting00_02.png)

### 3) ์ธํ…”๋ฆฌ์ œ์ด ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ

#### 3-1) ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ](./capture/setting01.png)

#### 3-2) ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ๋ฐ ์„ค์ •](./capture/setting02.png)

#### 3-3) ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ๋กœ๋”ฉ ์„ค์ •

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ](./capture/setting03.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting04.png)

#### 3-4) D:\kim\springStudy\study1\pom.xml ๊ธฐ๋ณธ ์„ค์ •

```xml

4.0.0
kr.co.study
study
war
1.0-SNAPSHOT
study Maven Webapp
http://maven.apache.org

17
5.3.20
1.9.0
2.0.0



org.springframework
spring-context
${org.springframework-version}


commons-logging
commons-logging




org.springframework
spring-webmvc
${org.springframework-version}


org.aspectj
aspectjrt
1.9.0



study1


maven-eclipse-plugin
2.9


org.springframework.ide.eclipse.core.springnature


org.springframework.ide.eclipse.core.springbuilder

true
true



org.apache.maven.plugins
maven-compiler-plugin
2.5.1

17
17
-Xlint:all
true
true



org.codehaus.mojo
exec-maven-plugin
1.2.1

org.test.int1.Main



```

#### 3-5) ํ†ฐ์บฃ ์„œ๋ฒ„ ๋‹ค์šด๋กœ๋“œ

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting05.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting06.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting07.png)

#### 3-5) ํ†ฐ์บฃ ์„œ๋ฒ„ ์„ค์ • ๋ฐ ์‹คํ–‰

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_1.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_2.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_3.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_4.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_5.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_6.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_7.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_8.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_9.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_10.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_11.png)

![์ธํ…”๋ฆฌ์ œ์ด ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ์„ค์ •](./capture/setting08_12.png)



# 02. Spring Framework ์„ค์ •

## 02-1. ์˜์กด์„ฑ ์„ค์ •

D:\kim\springStudy\study2\pom.xml ์„ค์ •

```xml

4.0.0
org.study2
study2
war
1.0-SNAPSHOT
study2 Maven Webapp
http://maven.apache.org

17
5.3.20
2.0.0



org.springframework
spring-context
${org.springframework-version}


commons-logging
commons-logging




org.springframework
spring-webmvc
${org.springframework-version}


org.aspectj
aspectjrt
1.9.0



org.slf4j
slf4j-api
${org.slf4j-version}


org.slf4j
jcl-over-slf4j
${org.slf4j-version}
runtime


org.slf4j
slf4j-log4j12
${org.slf4j-version}
runtime


log4j
log4j
1.2.15


javax.mail
mail


javax.jms
jms


com.sun.jdmk
jmxtools


com.sun.jmx
jmxri


runtime



javax.inject
javax.inject
1



javax.servlet
servlet-api
2.5
provided


javax.servlet.jsp
jsp-api
2.1
provided


javax.servlet
jstl
1.2



junit
junit
4.13
test


org.springframework
spring-test
${org.springframework-version}



org.apache.maven.plugins
maven-archetype-plugin
3.2.1



org.projectlombok
lombok
1.18.22



org.bgee.log4jdbc-log4j2
log4jdbc-log4j2
1.16



org.springframework
spring-jdbc
${org.springframework-version}



commons-dbcp
commons-dbcp
1.4



org.mariadb.jdbc
mariadb-java-client
3.1.4



org.springframework
spring-tx
${org.springframework-version}



org.mybatis
mybatis
3.4.0



org.mybatis
mybatis-spring
1.3.2



com.google.code.gson
gson
2.7



org.jsoup
jsoup
1.12.1



org.json
json
20200518



org.apache.clerezza.ext
org.json.simple
0.4



com.fasterxml.jackson.core
jackson-databind
2.9.4



org.codehaus.jackson
jackson-mapper-asl
1.9.13



org.springframework.security
spring-security-core
5.4.0


org.springframework.security
spring-security-web
5.4.0


org.springframework.security
spring-security-config
5.4.0



commons-fileupload
commons-fileupload
1.3.2


commons-io
commons-io
2.4



org.imgscalr
imgscalr-lib
4.0



javax.mail
javax.mail-api
1.4.7



org.springframework
spring-context-support
${org.springframework-version}



javax.validation
validation-api
2.0.1.Final



org.hibernate
hibernate-annotations
3.5.6-Final



org.hibernate.validator
hibernate-validator
6.0.8.Final


javax.xml.bind
jaxb-api
2.3.0


org.junit.jupiter
junit-jupiter
RELEASE
compile



javax.annotation
javax.annotation-api
1.3.2



com.ibm.icu
icu4j
4.0.1



study2


maven-eclipse-plugin
2.9


org.springframework.ide.eclipse.core.springnature


org.springframework.ide.eclipse.core.springbuilder

true
true



org.apache.maven.plugins
maven-compiler-plugin
2.5.1

17
17
-Xlint:all
true
true



org.codehaus.mojo
exec-maven-plugin
1.2.1

org.test.int1.Main



```

## 02-2. ์›น ์„ค์ •

D:\kim\springStudy\study2\src\main\webapp\WEB-INF\web.xml ์˜ ์„ค์ •

```xml

Study2 Web Application



contextConfigLocation
/WEB-INF/applicationContext.xml



org.springframework.web.context.ContextLoaderListener




appServlet
org.springframework.web.servlet.DispatcherServlet

contextConfigLocation

/WEB-INF/dispatcher-servlet.xml
/WEB-INF/spring-security.xml


1


appServlet
/



encodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8



encodingFilter
/*

```



## 02-3. ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ๋นˆ ๋“ฑ๋ก ๋ฐ ์„ค์ •

D:\kim\springStudy\study2\src\main\webapp\WEB-INF\applicationContext.xml

### 1) applicationContext.xml ์ƒ์„ฑ

- D:\kim\springStudy\study2\src\main\webapp\WEB-INF ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ์„ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— applicationContext.xml์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![applicationContext.xml ํŒŒ์ผ ์ถ”๊ฐ€](./capture/setting09.png)

![applicationContext.xml ํŒŒ์ผ ์ถ”๊ฐ€](./capture/setting09_1.png)


### 2) applicationContext.xml ์ž‘์„ฑ

```xml




















```


## 02-4. ๋งตํผ ๋“ฑ๋ก ๋ฐ ์„ค์ •

### 1) mybatis-config.xml ํŒŒ์ผ ์ƒ์„ฑ

D:\kim\springStudy\study2\src\main\resources ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ์„ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— mybatis-config.xml์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![mybatis-config.xml ํŒŒ์ผ ์ถ”๊ฐ€](./capture/setting09_2.png)

![mybatis-config.xml ํŒŒ์ผ ์ƒ์„ฑ](./capture/setting09_3.png)


### 2) mybatis-config.xml ํŒŒ์ผ ์ž‘์„ฑ

```xml



```


### 3) mappers ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ ๋ฐ ํŒŒ์ผ ์ž‘์„ฑ

- D:\kim\springStudy\study2\src\main\resources ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[Directory] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— mappers์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![mappers ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ](./capture/setting09_4.png)

![mappers ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ](./capture/setting09_5.png)

- D:\kim\springStudy\study2\src\main\resources\mappers ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ์„ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— testMapper.xml์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![testMapper.xml ํŒŒ์ผ ์ƒ์„ฑ](./capture/setting09_51.png)

![testMapper.xml ํŒŒ์ผ ์ƒ์„ฑ](./capture/setting09_6.png)

```xml


select * from test

```



## 02-5. ์„œ๋ธ”๋ฆฟ ๋“ฑ๋ก ๋ฐ ์„ค์ •

### 1) ์„œ๋ธ”๋ฆฟ ๋””์ŠคํŒจ์ฒ˜ ์ž‘์„ฑ - dispatcher-servlet.xml ์ž‘์„ฑ

- D:\kim\springStudy\study2\src\main\webapp\WEB-INF ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— dispatcher-servlet.xml์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![dispatcher-servlet.xml ํŒŒ์ผ ์ƒ์„ฑ](./capture/setting10.png)

![dispatcher-servlet.xml ํŒŒ์ผ ์ƒ์„ฑ](./capture/setting10_1.png)

```xml






































```


### 2) ์„œ๋ธ”๋ฆฟ ํ”ผ์ŠคํŒจ์ฒ˜์—์„œ ์„ค์ •ํ•œ ์ ‘๊ทผ ์ž์›์— ๋Œ€ํ•œ ๋””๋ ‰ํ† ๋ฆฌ ์ƒ์„ฑ

- D:\kim\springStudy\study2\src\main\webapp\WEB-INF ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[Directory] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— views๋ฅผ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

- D:\kim\springStudy\study2\src\main\webapp\WEB-INF\views ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[Directory] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— admin๋ฅผ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

- ์œ„์™€ ๊ฐ™์ด views ๋””๋ ‰ํ† ๋ฆฌ ์•ˆ์— board, check, guestbook, free, qna, include, member, notice, reservation, util, test, error ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

- D:\kim\springStudy\study2\src\main\webapp ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[Directory] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— resource๋ฅผ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

- ์œ„์™€ ๊ฐ™์ด webapp ๋””๋ ‰ํ† ๋ฆฌ ์•ˆ์— data ๋””๋ ‰ํ† ๋ฆฌ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

![dispatcher-servlet.xml ํŒŒ์ผ ์ƒ์„ฑ](./capture/setting10_2.png)



## 02-6. ๋กœ๊ทธ ์ถœ๋ ฅ ๋ฐ ๋ฐฑ์—… ์„ค์ •

### 1) log4j.xml ์ƒ์„ฑ ๋ฐ ์ž‘์„ฑ

- D:\kim\springStudy\study2\src\main\resources ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— log4j.xml์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![log4j.xml ์ž‘์„ฑ](./capture/setting11.png)

![log4j.xml ์ž‘์„ฑ](./capture/setting11_1.png)

```xml





































```


### 2) ๊ด€๋ จ ํŒจํ‚ค์ง€ ์ƒ์„ฑ

- D:\kim\springStudy\study2\src\main ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[Directory] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— java๋ฅผ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

- D:\kim\springStudy\study2\src\main\java ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[Package] ๋ฅผ ์„ ํƒํ•˜์—ฌ ์•„๋ž˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์ด log4j.xml์—์„œ ์ง€์ •ํ•œ ํŒจํ‚ค์ง€๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

![๊ด€๋ จ ํŒจํ‚ค์ง€ ์ž‘์„ฑ](./capture/setting11_2.png)


### 3) ๋กœ๊ทธ ๋ฐฑ์—… ํŒŒ์ผ ์ž‘์„ฑ - logback.xml ์ž‘์„ฑ

- D:\kim\springStudy\study2\src\main\resources ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— logback.xml์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![logback.xml ์ž‘์„ฑ](./capture/setting12.png)

![logback.xml ์ž‘์„ฑ](./capture/setting12_1.png)

```xml








%d{HH:mm:ss.SSS} [%thread] %-4level [%logger.%method:%line]-
%msg%n


/WEB-INF/logback.log

logback.%d{yyyy-MM-dd}.log

30


%d{yyyy-MM-dd HH:mm:ss.SSS} %-4level [%logger.%method:%line]
- %msg %n









```


### 4) ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ๋กœ๊ทธ ํŒŒ์ผ ์ž‘์„ฑ - log4jdbc.log4j2.properties ์ž‘์„ฑ

- D:\kim\springStudy\study2\src\main\resources ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— log4jdbc.log4j2.properties๋ฅผ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![log4jdbc.log4j2.properties ์ž‘์„ฑ](./capture/setting13.png)

![log4jdbc.log4j2.properties ์ž‘์„ฑ](./capture/setting13_1.png)

```properties
log4jdbc.spylogdelegator.name=net.sf.log4jdbc.log.slf4j.Slf4jSpyLogDelegator
```



## 02-7. ์•”ํ˜ธํ™” ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์—ฐ๊ฒฐ - spring-security.xml ํŒŒ์ผ ์ž‘์„ฑ

- D:\kim\springStudy\study2\src\main\webapp\WEB-INF ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[File] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— spring-security.xml์„ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![spring-security.xml ํŒŒ์ผ ์ž‘์„ฑ](./capture/setting14.png)

![spring-security.xml ํŒŒ์ผ ์ž‘์„ฑ](./capture/setting14_1.png)

## 02-8. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์„ค์ •

- ๋งˆ๋ฆฌ์•„DB ์˜ GUI ๋„๊ตฌ์ธ HeidiSQL์„ ์‹คํ–‰ํ•˜๊ณ , ์ ‘์†ํ•œ ํ›„ ์•„๋ž˜ ๊ทธ๋ฆผ๊ณผ ๊ฐ™์ด ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ํ…Œ์ŠคํŠธ์šฉ ํ…Œ์ด๋ธ”์„ ์ž‘์„ฑํ•œ ํ›„ ๋”๋ฏธ ๋ฐ์ดํ„ฐ๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

```sql
CREATE DATABASE haebeop;

USE haebeop;

CREATE TABLE test(num INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL);

INSERT INTO test VALUES (DEFAULT, 'ํ…Œ์ŠคํŠธ์ œ๋ชฉ1');
INSERT INTO test VALUES (DEFAULT, 'ํ…Œ์ŠคํŠธ์ œ๋ชฉ2');
INSERT INTO test VALUES (DEFAULT, 'ํ…Œ์ŠคํŠธ์ œ๋ชฉ3');
INSERT INTO test VALUES (DEFAULT, 'ํ…Œ์ŠคํŠธ์ œ๋ชฉ4');
INSERT INTO test VALUES (DEFAULT, 'ํ…Œ์ŠคํŠธ์ œ๋ชฉ5');

SELECT * from test;
```



## 02-9. ๋„๋ฉ”์ธ(dto) ์ƒ์„ฑ

- D:\kim\springStudy\study2\src\main\java\kr\ed\haebeop\domain ํŒจํ‚ค์ง€ ๋””๋ ‰ํ† ๋ฆฌ์—์„œ ๋งˆ์šฐ์Šค ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๊ณ  ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ [New]-[Java Class] ๋ฅผ ์„ ํƒํ•˜๊ณ , ์ž…๋ ฅ ๋ž€์— Test๋ฅผ ์ž…๋ ฅํ•˜๊ณ , Enter๋ฅผ ์นฉ๋‹ˆ๋‹ค.

![Test ํด๋ž˜์Šค ์ž‘์„ฑ](./capture/setting15.png)

![Test ํด๋ž˜์Šค ์ž‘์„ฑ](./capture/setting15_1.png)

```java
package kr.ed.heabeop.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Test {
private int num;
private String title;
}
```






# 03. Spring Framework MVC ํŒจํ„ด ๊ตฌํ˜„๊ณผ DI ๋ฐ IoC ๊ตฌํ˜„

## 03-1. ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ํ…Œ์ด๋ธ” ๋งŒ๋“ค๊ธฐ

### 1) ๋งˆ๋ฆฌ์•„DB ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์น˜
https://mariadb.org/download/?t=mariadb&p=mariadb&r=11.0.3&os=windows&cpu=x86_64&pkg=msi&m=blendbyte

![๋งˆ๋ฆฌ์•„DB ๋‹ค์šด๋กœ๋“œ](./capture/spring030102.png)

### 2) HeidiSQL ๋‹ค์šด๋กœ๋“œ ๋ฐ ์„ค์น˜
https://www.heidisql.com/download.php

![Test ํด๋ž˜์Šค ์ž‘์„ฑ](./capture/spring030101.png)


## 03-2. Spring Framework MVC Domain ์ž‘์„ฑ

### 1) domain ํŒจํ‚ค์ง€ ์ƒ์„ฑ

### 2) TestVO.java (ํด๋ž˜์Šค) ์ƒ์„ฑ

```java
package kr.ed.haebeop.domain;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class TestVO {
private int num;
private String title;
}
```


## 03-3. Spring Framework MVC Mapper ์ž‘์„ฑ

### 1) testMapper.xml์— ์ƒˆ๋กœ์šด ๋ฌธ์žฅ ๋“ฑ๋ก


## 03-4. Spring Framework MVC Repository ๊ตฌํ˜„

### 1) repository ํŒจํ‚ค์ง€ ์ƒ์„ฑ

### 2) TestRepository.java (์ธํ„ฐํŽ˜์ด์Šค) ์ถ”์ƒ์ฒด ์ƒ์„ฑ

```java
package kr.ed.haebeop.repository;

import kr.ed.haebeop.domain.TestVO;

import java.util.List;

public interface TestRepository {
public List testList() throws Exception;
}
```

### 3) TestRepositoryImpl.java (ํด๋ž˜์Šค) ๊ตฌํ˜„์ฒด ์ƒ์„ฑ

```java
package kr.ed.haebeop.repository;
import kr.ed.haebeop.domain.TestVO;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class TestRepositoryImpl implements TestRepository {

@Autowired
private SqlSession sqlSession;

@Override
public List testList() throws Exception {
return sqlSession.selectList("test.testList");
}
}
```


## 03-5. Spring Framework MVC Service ๊ตฌํ˜„

### 1) service ํŒจํ‚ค์ง€ ์ƒ์„ฑ

### 2) TestService.java (์ธํ„ฐํŽ˜์ด์Šค) ์ถ”์ƒ์ฒด ์ƒ์„ฑ

```java
package kr.ed.haebeop.service;
import kr.ed.haebeop.domain.TestVO;
import java.util.List;

public interface TestService {
public List testList() throws Exception;
}
```

### 3) TestServiceImpl.java (ํด๋ž˜์Šค) ๊ตฌํ˜„์ฒด ์ƒ์„ฑ

```java
package kr.ed.haebeop.service;

import kr.ed.haebeop.domain.TestVO;
import kr.ed.haebeop.repository.TestRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TestServiceImpl implements TestService {

@Autowired
private TestRepository testRepository2;

@Override
public List testList() throws Exception {
return testRepository2.testList();
}
}
```


## 03-6. Spring Framework MVC Bean ์„ค์ • ๋ฐ ์ถ”๊ฐ€

### 1) ApplicationConfig.java์— TestVO์— ๋Œ€ํ•œ Repository ๋ฐ Service ๋นˆ(Bean) ์ฃผ์ž…

```java
package kr.ed.haebeop.config;

import kr.ed.haebeop.repository.TestRepository;
import kr.ed.haebeop.repository.TestRepositoryImpl;
import kr.ed.haebeop.service.TestService;
import kr.ed.haebeop.service.TestServiceImpl;
import kr.ed.haebeop.test.transaction.TransactionRepository;
import kr.ed.haebeop.test.transaction.TransactionService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;

@Configuration
@ComponentScan(basePackages = "kr.ed.haebeop")
public class ApplicationConfig {
@Bean
public TestService testService3(){
return new TestServiceImpl();
}

@Bean
public TestRepository testRepository3(){
return new TestRepositoryImpl();
}

@Bean
public TransactionRepository tranRepository() { return new TransactionRepository(); }

@Bean
public TransactionService tranService() { return new TransactionService(); }
}
```


## 03-7. Spring Framework MVC View(jsp) ๊ตฌํ˜„

### 1) testLisp.jsp ์ž‘์„ฑ

```jsp
<%@ page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fn" uri = "http://java.sun.com/jsp/jstl/functions"%>



Title

${test.num}


${test.title}



```


## 03-8. applicationContext.xml์— Bean์„ ๋“ฑ๋กํ•˜๊ณ , ์ฃผ์ž… ๋ฐ ๊ตฌํ˜„ํ•˜๊ธฐ

```xml
... ์ค‘๋žต ...







... ์ค‘๋žต ...
```


## 03-9. ๋ณ„๋„์˜ GenericXmlApplicationContext.xml์— Bean์„ ๋“ฑ๋กํ•˜๊ณ , ์ฃผ์ž… ๋ฐ ๊ตฌํ˜„ํ•˜๊ธฐ

## 03-10. @Configuration ์–ด๋…ธํ…Œ์ด์…˜์„ ํ™œ์šฉํ•œ ์ž๋ฐ” Confirurer๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์ฃผ์ž… ๋ฐ ๊ตฌํ˜„ํ•˜๊ธฐ

## 03-11. ์ฃผ์ž…๊ณผ ๊ด€๋ จํ•œ ์–ด๋…ธํ…Œ์ด์…˜






# 04. Spring Framework ์˜ AOP(๊ด€์ ์ง€ํ–ฅํ˜•) ๊ตฌํ˜„

## 04-1. Spring Framework ์—์„œ์˜ ๊ด€์ ์ง€ํ–ฅํ˜•์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•œ ์ž๋ฐ” ๋””์ž์ธ ํŒจํ„ด

## 04-2. Spring Framework AOP๋ฅผ ํ™œ์šฉํ•œ ๊ด€์ ์ง€ํ–ฅํ˜• ๊ตฌํ˜„

## 04-3. ํŠธ๋žœ์žญ์…˜ ๊ณ ๋ฆฝ์„ฑ ๋ ˆ๋ฒจ์˜ Sql ์‹ค์Šต

## 04-4. Service ๋ฐ Repository์—์„œ ํŠธ๋žœ์žญ์…˜์˜ ๊ตฌํ˜„ ์‹ค์Šต






# 05. json๊ณผ Api

## 05-1. ๋ฐ์ดํ„ฐ ์ฃผ๊ณ  ๋ฐ›๋Š” ์—ฌ๋Ÿฌ ์–ด๋…ธํ…Œ์ด์…˜

## 05-2. ํผ ๋ฐ์ดํ„ฐ ๊ฒ€์ฆ

## 05-3. json ๊ตฌํ˜„

## 05-4. ajax ๊ตฌํ˜„

## 05-5. api ๊ตฌํ˜„






# 06. Spring Security ์•”ํ˜ธํ™”

# 07. ์ธํ„ฐ์…‰ํ„ฐ์™€ ๋กœ๊ทธ์ธ ์ฒ˜๋ฆฌ

# 08. Multipart์™€ FileUpload ๊ธฐ๋Šฅ ๊ตฌํ˜„

# 09. ์—ฌ๋Ÿฌ ๋ถ€๊ฐ€ ๊ธฐ๋Šฅ ๊ตฌํ˜„