๐Ÿ”ฎ ์˜ค๋ธŒ์ ํŠธ์™€ ์˜์กด๊ด€๊ณ„ ๐Ÿ”ฎ ์˜ค๋ธŒ์ ํŠธ์™€ ์˜์กด๊ด€๊ณ„ ๐Ÿ˜–๋‚œ๊ฐํ•œ DAO ๐Ÿ”Œ JDBC ๐Ÿ’” DAO์˜ ๋ถ„๋ฆฌ ๊ณตํ†ต๊ธฐ๋Šฅ์„ ๋…๋ฆฝ์‹œํ‚ค๊ธฐ ์ƒ์†์„ ํ†ตํ•œ ํ™•์žฅ DAO์˜ ํ™•์žฅ ์ƒˆ๋กœ์šด ๊ฐ์ฒด๋ฅผ ์ƒ์„ฑํ•˜๋Š” ๊ฒฝ์šฐ ๊ด€๊ณ„์„ค์ • ์ฑ…์ž„์˜ ๋ถ„๋ฆฌ < ์ดํ•ด ์ž˜ ์•ˆ๋˜์„œ ๋‹ค์‹œ๋ด์•ผ.. > ๐Ÿ“Œ ์›์น™๊ณผ ํŒจํ„ด โญ SOLID SRP (Single Responsibility Principle) ๋‹จ์ผ ์ฑ…์ž„ ์›์น™ OCP (Open Closed Principle) ๊ฐœ๋ฐฉ ํ์‡„ ์›์น™ LSP (Liskov Substitution Principle) ๋ฆฌ์Šค์ฝ”ํ”„ ์น˜ํ™˜ ์›์น™ ISP (Interface Segregation Principle) ์ธํ„ฐํŽ˜์ด์Šค ๋ถ„๋ฆฌ ์›์น™ DIP (Dependency Inversion Principle) ์˜์กด ์—ญ์ „ ์›์น™ ๐Ÿ’ก ์ „๋žต ํŒจํ„ด ๐ŸŽฏ ์ œ์–ด์˜ ์—ญ์ „ (IoC) ์Šคํ”„๋ง์€ ์˜ค๋ธŒ์ ํŠธ์— ๊ด€ํ•œ ์„ค๊ณ„์™€ ๋™์ž‘ ๊ฒ€์ฆ, ๊ตฌ์กฐ๋ฅผ ์ง€์†์ ์œผ๋กœ ๊ฐœ์„ ํ•˜๋Š” ํ…Œ์ŠคํŠธ๋“ฑ์˜ ์—ฌ๋Ÿฌ๊ฐ€์ง€ ์ง€์‹์ด ์š”๊ตฌ๋˜๋Š” ํ”„๋ ˆ์ž„์›Œํฌ๋กœ์จ ์˜ค๋ธŒ์ ํŠธ์— ๋Œ€ํ•œ ๊ด€์‹ฌ๊ณผ ๊ฐ์ฒด์ง€ํ–ฅ ๊ธฐ์ˆ  ์ด ์ œ๊ณตํ•˜๋Š” ํ˜œํƒ๊ณผ ๋ชฉ์ ์„ฑ์„ ๊ฐ•์กฐํ•œ๋‹ค.

Continue reading

AOP (๊ด€์  ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ) AOP (๊ด€์  ์ง€ํ–ฅ ํ”„๋กœ๊ทธ๋ž˜๋ฐ) AOP์˜ ๊ตฌ์„ฑ์š”์†Œ *Target *Aspect *Advice - Interceptor (What?) *Join Point - When? *Point Cut - Where? *Proxy *Weaving โœ”๏ธ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ „์ฒด์—์„œ ์‚ฌ์šฉ๋˜๋Š” ๊ธฐ๋Šฅ์„ ์žฌ์‚ฌ์šฉ โœ”๏ธ ํšก๋‹จ ๊ด€์‹ฌ์‚ฌ์˜ ๋ถ„๋ฆฌ (Seperation of Concern) ๊ธฐ์กด์˜ OOP์™€๋Š” ๋‹ค๋ฅธ ๊ด€์ ์œผ๋กœ ๋ถ€๊ฐ€๊ธฐ๋Šฅ์ ์ธ ์ธก๋ฉด์—์„œ์˜ ๊ณตํ†ต๋œ ์š”์†Œ๋ฅผ ๊ฐ•์กฐํ•˜๋Š” ๊ฒƒ์ด๋‹ค. OOP AOP ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง ๊ฐ๊ฐ์˜ ๋ชจ๋“ˆ์— ํ•„์š”ํ•œ ๋ถ€๊ฐ€๊ธฐ๋Šฅ ํ•ต์‹ฌ๊ด€๋ฆฌ ๋ชจ๋“ˆ(class or service)๋งˆ๋‹ค ํ•„์š”ํ•œ ๋ชจ๋“ˆ(code)์„ ์ง์ ‘ ํ˜ธ์ถœํ•˜์ง€์•Š๊ณ  Weavingํ•˜์—ฌ ํšก๋‹จ๊ด€์‹ฌ ์ฝ”๋“œ๊ฐ€ ์‚ฝ์ž… ์žฌ์‚ฌ์šฉ ๋˜๋„๋ก ํ•˜๋Š” ๋ฐฉ๋ฒ•.

Continue reading

Interceptor & Annotation โœ”๏ธ HTTP Request / Response์˜ Controller ์•ž๋’ค์— ์š”์ฒญ/์‘๋‹ต์„ ๊ฐ€๋กœ์ฑ„ ์ž‘์—…์„ ์ˆ˜ํ–‰ํ•˜๋Š” ์—ญํ•  โœ”๏ธ HandlerInterceptor ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์ด์šฉํ•ด ๊ตฌํ˜„ํ•œ๋‹ค. implements : preHandle() postHandle() afterCompletion() โœ”๏ธ ์˜ˆ์ œ์—์„œ๋Š” ์„ธ์…˜์ฒ˜๋ฆฌ์— ๊ด€๋ จ๋œ @Auth ๋ฅผ ๊ตฌํ˜„ ํ•ด๋ดค๋‹ค. ํ•„ํ„ฐ๋Š” ๊ทธ๋ฆผ์—์„œ ๋ณด์ด๋“ฏ Servlet์˜ ์•ž์—์„œ ๊ด€์—ฌํ•˜๋ฉฐ Interceptor๋Š” Controller์˜ ์•ž๋’ค์—์„œ ์ด๋ฃจ์–ด์ง„๋‹ค HandlerInterceptorAdapter Interceptor์˜ ๊ตฌํ˜„์‹œ ์ƒ์†๋ฐ›์•„ ์ด์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์ถ”์ƒ ํด๋ž˜์Šค์ด๋‹ค. Interceptor ๊ตฌํ˜„์‹œ ํ•„์š”ํ•œ HandlerInterceptor ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ๊ธฐ๋ณธ์œผ๋กœ ๊ตฌํ˜„ํ•œ ํด๋ž˜์Šค ์ด๊ธฐ ๋•Œ๋ฌธ์— Method๋งŒ Overrideํ•˜์—ฌ ๊ตฌํ˜„ ํ•  ์ˆ˜ ์žˆ๋‹ค.

Continue reading

Message Converter & Log Message Converter XML์ด๋‚˜ JSON์„ ์ด์šฉํ•œ Ajax์ฒ˜๋ฆฌ์™€ Client - Server ์‚ฌ์ด์˜ ๋ฉ”์„ธ์ง€ ์ „์†ก์— ์ด์šฉ๋จ Request Body / Response Body ๊ตฌ์กฐ ๋ฉ”์„œ๋“œ ํŒŒ๋ผ๋ฏธํ„ฐ์— @RequestBody, ๋ฉ”์„œ๋“œ ๋ฐ˜ํ™˜ํƒ€์ž…์œผ๋กœ @ResponseBody ํ˜น์€ ๋ฉ”์„œ๋“œ ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ ์ด์šฉ Message Converter๋Š” AnnotationMethodHandlerAdpater ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ํ†ตํ•ด ํ•˜๋‚˜์ด์ƒ์˜ ์ปจ๋ฒ„ํ„ฐ๊ฐ€ ๋“ฑ๋ก, ์„ ํƒ ๋™์ž‘ํ•˜๊ฒŒ ๋œ๋‹ค. <mvc:annotation-driven/>์—์„œ ์ž๋™์œผ๋กœ ๋“ฑ๋ก๋œ๋‹ค. <mvc:annotation-driven/> ๋””ํดํŠธ bean๊ณผ ํ•จ๊ป˜ Jackson๊ณผ JAXB๊ฐ€ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋กœ ๋“ฑ๋ก ๋˜์–ด์žˆ์„ ๊ฒฝ์šฐ ๊ฐ™์ด ๋“ฑ๋ก๋œ๋‹ค. โœ”๏ธ ์ฃผ๋กœ Ajax์ฒ˜๋ฆฌ์˜ ์ƒํƒœ ๋ฉ”์„ธ์ง€ ์ „์†ก์„ ์ฃผ๊ณ ๋ฐ›์„๋•Œ ์ด์šฉ๋œ๋‹ค.

Continue reading

Author's picture

JIHUN HONG


Junior Developer

Seoul, South Korea