Loading...
2020. 4. 21. 10:59

[Spring boot] ๋‹ค์–‘ํ•œ ์–ด๋…ธํ…Œ์ด์…˜์„ ํ™œ์šฉํ•œ HTTP API ๊ตฌํ˜„

์ง€๋‚œ ํฌ์ŠคํŠธ์—์„œ IntelliJ IDEA๋ฅผ ์ด์šฉํ•˜์—ฌ Spring boot ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“œ๋Š” ์‹œ๊ฐ„์— ๋Œ€ํ•ด ์•Œ์•„๋ดค์Šต๋‹ˆ๋‹ค. ํ™•์‹คํžˆ ๊ธฐ์กด์˜ Spring์— ๋น„ํ•˜์—ฌ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ ์ ˆ์ฐจ๊ฐ€ ๊ฐ„๋‹จํ•˜๊ณ , ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •๋„ ๊นŒ๋‹ค๋กญ์ง€ ์•Š์€ ๋ชจ์Šต์ด์—ˆ์Šต๋‹ˆ๋‹ค. ์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” ๊ทธ์— ์ด์–ด์„œ ๊ฐ„๋‹จํ•œ HTTP API๋ฅผ ๊ตฌํ˜„ํ•˜๋Š” ์‹œ๊ฐ„์„ ๊ฐ€์ ธ๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. Hello World ๊ฐ€์žฅ ๋จผ์ € ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ œ๋Œ€๋กœ ์‹คํ–‰๋˜๋Š”์ง€ ํ…Œ์ŠคํŠธํ•˜๋Š” ๋ฐฉ๋ฒ•์€ ์–ด๋–ค ๋ฌธ๊ตฌ๋ฅผ ์ถœ๋ ฅํ•ด๋ณด๋Š” ๋ฐฉ๋ฒ•์ด ๊ฐ€์žฅ ์ข‹๊ฒ ์ฃ ? REST API์—์„œ ํŒŒ๋ผ๋ฏธํ„ฐ๋„ ๋ฐ›์ง€ ์•Š๊ณ , ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ๋ฉ”์†Œ๋“œ๋กœ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” GET ๋ฉ”์†Œ๋“œ๋ฅผ ์ด์šฉํ•ด Hello World๋ฅผ ์ถœ๋ ฅํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. package xyz.neonkid.blogexample import org.springframework..

2020. 4. 21. 10:33

[Spring boot] IntelliJ IDEA๋ฅผ ์ด์šฉํ•œ Spring boot ํ”„๋กœ์ ํŠธ ์‹œ์ž‘

๊ธฐ์กด์˜ Java ์–ธ์–ด๋ฅผ ์ด์šฉํ•ด์„œ ์›น ๊ฐœ๋ฐœ์„ ์œ„ํ•ด์„œ๋Š” Tomcat, Jetty ๋“ฑ๊ณผ ๊ฐ™์€ Servlet Container๋ฅผ ์„ค์น˜ํ•˜๊ณ , ํ”„๋กœ์ ํŠธ ๋‚ด์— ํ™˜๊ฒฝ์„ ๊ตฌ์„ฑํ•ด์•ผ ํ–ˆ๊ณ , ๋Œ€ํ‘œ์ ์ธ Java Application Framework์ธ Spring ์—ญ์‹œ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •์ด ๋งŒ๋งŒ์น˜ ์•Š๋‹ค๋Š” ์ด์œ ๋กœ Java ์–ธ์–ด๋ฅผ ์ž˜ ์‚ฌ์šฉํ•˜๋Š” ๋ถ„์ด ์•„๋‹Œ ๋ถ„๋“ค์€ ๋Œ€๋ถ€๋ถ„ ์›น ๊ฐœ๋ฐœ์„ ์œ„ํ•ด ๋น„๊ต์  ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •์ด ์‰ฌ์šด Node.js์˜ Express๋‚˜ Python์˜ Django ๋“ฑ์„ ๋งŽ์ด ์‚ฌ์šฉํ•˜์ฃ . Spring boot Spring boot๋Š” ์ด๋Ÿฌํ•œ Spring์˜ ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •์˜ ์–ด๋ ค์›€๊ณผ ๋ถ€๋‹ด์„ ๋œ์–ด์ฃผ๊ธฐ ์œ„ํ•ด ๊ฐœ๋ฐœ ํ™˜๊ฒฝ ์„ค์ •์„ ์ตœ์†Œํ™” ํ•˜๊ณ , ๊ฐœ๋ฐœ์ž๊ฐ€ ๋น„์ฆˆ๋‹ˆ์Šค ๋กœ์ง์— ์ง‘์ค‘ํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค๋‹ˆ๋‹ค. ๋จผ์ € Spring boot์˜ ํŠน์ง•๋ถ€ํ„ฐ ๊ฐ„๋‹จํžˆ..

2020. 4. 6. 13:41

[Algorithm] - 2019 Kakao Winter internship Coding test ๋ฌธ์ œ ํ’€์ด

2๋…„ ์ „๋ถ€ํ„ฐ ๊ณ„์†, ์‹œ๊ฐ„์ด ๋‚  ๋•Œ๋งˆ๋‹ค(๊ทธ ์‹œ๊ฐ„์ด ์–ผ๋งˆ ๋˜์ง€ ์•Š์ง€๋งŒ..) ํ‹ˆํ‹ˆ์ด ์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ ํ’€์ด๋ฅผ ๊ณ„์† ์ด์–ด๊ฐ€๊ณ  ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค. ๋‹ค์–‘ํ•œ ๋ฌธ์ œ๋“ค์„ ๋ณด์•˜๊ณ , ์–ด๋ ค์šด ๋ฌธ์ œ, ์ƒ๊ฐ์ด ๋‚  ๊ฒƒ ๊ฐ™์œผ๋ฉด์„œ๋„ ๋‡Œ์ •์ง€๊ฐ€ ์˜ค๋Š” ๋ฌธ์ œ, ์‰ฝ๊ฒŒ ํ’€๋งŒํ•œ ๋ฌธ์ œ๋“ค ๋‹ค์–‘ํ•œ ๋ฌธ์ œ๋“ค์ด ์กด์žฌํ•˜์˜€์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋˜ ์ค‘, ์ž‘๋…„ ๊ฒจ์šธ์— ์žฌ๋ฏธ์‚ผ์•„ ์นด์นด์˜ค ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ ๋ฌธ์ œ๋ฅผ ํ’€๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ๋ฌธ์ œ ๋‚œ์ด๋„๋Š” ์ƒ๊ฐํ•œ ๊ฒƒ๋ณด๋‹ค๋Š” ์กฐ๊ธˆ ์–ด๋ ค์šด ์ˆ˜์ค€์— ํ•ด๋‹นํ–ˆ์œผ๋ฉฐ ์–ด์ฐจํ”ผ ์ฝ”๋”ฉ ํ…Œ์ŠคํŠธ์—์„œ ์ข‹์€ ์„ฑ์ ์„ ๊ฑฐ๋‘์ง€ ๋ชปํ–ˆ๋”๋ผ๋„ ์ฐจํ›„์— ๋ฌธ์ œ ํ’€์ด ํ•ด์„ค์ด ์˜ฌ๋ผ์˜ค๊ธฐ ๋•Œ๋ฌธ์— ๊ฐ€๋ฒผ์šด ๋งˆ์Œ์œผ๋กœ ์‹œํ—˜์— ์ž„ํ–ˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ๋ช‡ ๋‹ฌ์ด ์ง€๋‚˜๋„ ํ•ด๋‹น ์ฝ”๋”ฉํ…Œ์ŠคํŠธ์— ๋Œ€ํ•œ ๋ฌธ์ œ ํ’€์ด ํ•ด์„ค์€ ๋ณด์ด์ง€ ์•Š์•˜๊ณ , ๊ทธ ํ•ด์„ค์„ ์ตœ๊ทผ์—์„œ์•ผ ๋ฐœ๊ฒฌํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. (๊ทธ๊ฒƒ๋„ Google ๊ฒ€์ƒ‰์ด ์นœ์ ˆํ•˜๊ฒŒ ์ด๊ฒƒ์ด ์žˆ๋‹ค๋Š” ๊ฑธ..

2020. 3. 28. 20:31

[Spring Cloud] - 7. Hystrix๋ฅผ ์ด์šฉํ•œ Circuit Breaker (๊ธฐ๋ณธํŽธ)

์ง€๋‚œ ํฌ์ŠคํŠธ์— ์ด์–ด์„œ Spring Cloud์—์„œ Circuit Breaker๋ฅผ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ๋Š” ์ฒซ ๋ฒˆ์งธ ํŒŒํŠธ๋ฅผ ๋“ค์–ด๊ฐ€๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. Hystrix Hystrix๋Š” Spring Cloud ์Šคํƒ์—์„œ ์ œ๊ณตํ•˜๋Š” Circuit Breaker ์ค‘ ํ•˜๋‚˜์ž…๋‹ˆ๋‹ค. Netflix์—์„œ ๊ฐœ๋ฐœํ–ˆ์œผ๋ฉฐ ํ˜„์žฌ๋Š” Spring Cloud์˜ ํ‘œ์ค€ Circuit Breaker๋กœ ์ž๋ฆฌ ์žก๊ณ  ์žˆ์ฃ . ๊ธฐ๋ณธ์ ์œผ๋กœ Hystrix๋Š” ์œ„์™€ ๊ฐ™์€ ํ˜•ํƒœ๋กœ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค. ๋ธŒ๋ผ์šฐ์ € ํ˜น์€ ๋ชจ๋ฐ”์ผ์—์„œ ์–ด๋–ค API ์š”์ฒญ์ด ๋“ค์–ด์™”์„ ๊ฒฝ์šฐ, ํ•ด๋‹น ์„œ๋น„์Šค์˜ ์—”๋“œํฌ์ธํŠธ๊ฐ€ ํ˜ธ์ถœ๋˜๋Š”๋ฐ, ์ด ๋•Œ ์„œ๋น„์Šค์— ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๊ฑฐ๋‚˜ ์‘๋‹ต์ด ์—†์„ ๊ฒฝ์šฐ, ์ดํ›„ ์ด์šฉ์ž์—๊ฒŒ ์žฅ์• ๊ฐ€ ์ „ํŒŒ๋˜์ง€ ์•Š๊ณ , ๋ฏธ๋ฆฌ ์ •์˜๋œ ์˜ค๋ฅ˜๋ฅผ ๋ธŒ๋ผ์šฐ์ € ํ˜น์€ ๋ชจ๋ฐ”์ผ์—์„œ ์ „์†กํ•˜๊ฒŒ ๋˜์–ด ์˜ค๋ฅ˜ ์ „ํŒŒ๋ฅผ ๋ง‰์•„์ฃผ๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋ฉด..

2020. 3. 11. 19:01

[MSA] - 4. Circuit Breaker๋ฅผ ์ด์šฉํ•œ ์žฅ์•  ์ฒ˜๋ฆฌ

MSA์— ๋Œ€ํ•ด์„œ ์šฐ๋ฆฌ๋Š” ๊ฐ API ์„œ๋ฒ„๋ฅผ ๋ถ„๋ฆฌํ•˜์—ฌ ์šฉ๋„๋ณ„๋กœ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‚˜๋ˆ„๊ณ , ์•ž๋‹จ์—์„œ Gateway๋ฅผ ์‚ฌ์šฉํ•ด ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์›ํ•˜๋Š” ์„œ๋น„์Šค๋ฅผ ์ฃผ๊ณ , ๋กœ๋“œ ๋ฐธ๋Ÿฐ์‹ฑ ๋“ฑ์˜ ์ž‘์—…์ด ๋“ค์–ด๊ฐˆ ๊ฒฝ์šฐ, Service Discovery๋ฅผ ํ†ตํ•˜์—ฌ ์›ํ•˜๋Š” ์„œ๋น„์Šค๋ฅผ ๋™์ ์œผ๋กœ ์ฐพ์•„์ฃผ๋Š” ๋ฐฉ๋ฒ•๊นŒ์ง€ ์•Œ์•˜์Šต๋‹ˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ, ์ด๋ ‡๊ฒŒ ์„œ๋น„์Šค๋ฅผ ๋ถ„๋ฆฌํ•จ์œผ๋กœ์จ ํ•œ ์ธ์Šคํ„ด์Šค๊ฐ€ ๋ชจ๋“  ์„œ๋น„์Šค๋ฅผ ๊ฐ๋‹นํ•˜๋Š” ๋ถ€๋ถ„์ด ์™„ํ™”๋˜๋Š” ๋“ฑ์˜ ์žฅ์ ์ด ์ƒ๊ฒผ์ง€๋งŒ, ๋งŒ์•ฝ ์„œ๋น„์Šค์— ์žฅ์• ๊ฐ€ ๋ฐœ์ƒํ•œ๋‹ค๋ฉด ๊ทธ ์žฅ์• ๋Š” ์–ด๋–ป๊ฒŒ ์ฒ˜๋ฆฌํ•  ์ˆ˜ ์žˆ์„๊นŒ์š”? ์„œ๋น„์Šค๊ฐ€ ๋ถ„๋ฆฌ๋˜์–ด ์žˆ๋Š” ์ƒํƒœ์—์„œ ํด๋ผ์ด์–ธํŠธ์˜ ์ž˜๋ชป๋œ ์ž…๋ ฅ ๊ฐ’ ๋“ฑ์œผ๋กœ ์ƒ๊ธฐ๋Š” ์˜ค๋ฅ˜๋Š” ๋…ผ๋ฆฌ์ ์ธ ์˜ค๋ฅ˜์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ด๋Ÿฐ ์˜ค๋ฅ˜๋Š” Exception ๋“ฑ์˜ ์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ด์„œ ํด๋ผ์ด์–ธํŠธ์—๊ฒŒ ์˜ค๋ฅ˜๋ฅผ ์•Œ๋ ค์ฃผ๊ณ , ์ด๋ฅผ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ์ง„ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ..

2020. 2. 8. 22:31

[Spring Cloud] - 6. Eureka๋ฅผ ์ด์šฉํ•œ ์„œ๋น„์Šค ๊ฒ€์ƒ‰

MSA๋กœ ์„ค๊ณ„๋œ ์›น ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ๊ทธ ์ธ์Šคํ„ด์Šค๊ฐ€ ์„œ๋น„์Šค๋ณ„๋กœ ๋‚˜๋ˆ„์–ด์ ธ ์žˆ๊ณ , ๋งŒ์•ฝ ์ด๋ฅผ ๋กœ๋“œ ๋ฐธ๋Ÿฐ์‹ฑ์„ ์ด์šฉํ•ด ์—ฌ๋Ÿฌ ์„œ๋น„์Šค๋ฅผ ๋ถ„์‚ฐ ์ฒ˜๋ฆฌํ•˜๊ฒŒ ๋œ๋‹ค๋ฉด, ์„œ๋กœ ๋‹ค๋ฅธ ์ธ์Šคํ„ด์Šค๊ฐ€ ์—ฌ๋Ÿฌ ๊ฐœ ์ƒ๊ธฐ๊ฒŒ ๋˜๋ฉฐ, ๊ทธ๋ ‡๊ฒŒ ๋˜๋ฉด API ์š”์ฒญ๋งˆ๋‹ค ์ ์ ˆํ•œ ์ธ์Šคํ„ด์Šค์˜ Endpoint๋ฅผ ๋งค๊ฒจ์ค˜์•ผ ํ•ฉ๋‹ˆ๋‹ค. Service Discovery๋Š” ์ด๋Ÿฌํ•œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ณ ์ž, Server-Client ๋ฐฉ์‹๊ณผ ์œ ์‚ฌํ•œ Self-Registration Pattern์„ ์ด์šฉํ•ด ์ž์‹ ์˜ ์„œ๋น„์Šค๋ฅผ ์ค‘์•™์˜ Registry์— ๋“ฑ๋กํ•˜๊ณ , ์ด๋ฅผ ์š”์ฒญํ•  ๋•Œ๋งˆ๋‹ค ์•Œ๋งž๋Š” Endpoint๋ฅผ ๋งค์นญํ•ด์ค€๋‹ค๋Š” ๊ฒƒ์„ ์•Œ์•˜์Šต๋‹ˆ๋‹ค. Eureka Spring Cloud ์Šคํƒ์—์„œ ์ด๋Ÿฌํ•œ ์—ญํ• ์„ ํ•˜๋Š” ๋Œ€ํ‘œ์ ์ธ ๋ชจ๋“ˆ๋กœ Eureka๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. Eureka๋Š” Netflix OSS ์ค‘ ํ•˜๋‚˜๋กœ Spr..

2020. 1. 27. 13:08

[MSA] - 3. ํ•„์š”ํ•œ ์„œ๋น„์Šค๋ฅผ ์ฐพ์•„์ฃผ๋Š” Service Discovery

์•ˆ๋…•ํ•˜์„ธ์š”. ๋‹ค๋“ค ๊ตฌ์ • ์—ฐํœด ์ž˜ ๋ณด๋‚ด๊ณ  ๊ณ„์‹ ๊ฐ€์š”? ๊ตฌ์ • ์–ธํœด๊ธด ํ•˜์ง€๋งŒ, ์ €์—๊ฒŒ๋Š” ๊ธธ๊ฒŒ ๋Š๊ปด์ง€๋Š” ์—ฐํœด์ธ์ง€๋ผ, ์˜ค๋Š˜๋„ ์ด๋ ‡๊ฒŒ ๋„์ ์—ฌ ๋ด…๋‹ˆ๋‹ค. ์˜ค๋Š˜์€ Service Discovery์— ๋Œ€ํ•œ ์ด์•ผ๊ธฐ๋ฅผ ๋‹ค๋ค„๋ณด๋„๋ก ํ• ๊ฒŒ์š”. ์„œ๋น„์Šค ๋””์Šค์ปค๋ฒ„๋ฆฌ๋Š” ์ง€๋‚œ API Gateway์—์„œ๋„ ์ž ์‹œ ๋‹ค๋ค˜๋˜ ๋‚ด์šฉ์ด์ง€๋งŒ ์„œ๋น„์Šค๊ฐ€ ๋ถ„๋ฆฌ๋˜์–ด ์žˆ๋Š” MSA์—์„œ ๊ฐ ์„œ๋น„์Šค๊ฐ€ ๋‹ค์Œ์— ๋ถˆ๋Ÿฌ์•ผํ•  ์„œ๋น„์Šค๊ฐ€ ์–ด๋””์— ์žˆ๋Š”์ง€๋ฅผ ์ฐพ์•„์ฃผ๋Š” ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์ž…๋‹ˆ๋‹ค. What is Service Discovery ? ์‰ฌ์šด ์„ค๋ช…์„ ์œ„ํ•ด Wi-Fi๋ฅผ ์˜ˆ๋กœ ๋“ค์–ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๋Š” ์Šค๋งˆํŠธํฐ์ด๋‚˜ ํƒœ๋ธ”๋ฆฟ PC, ๋…ธํŠธ๋ถ์—์„œ ์ธํ„ฐ๋„ท์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด Wi-Fi์— ์—ฐ๊ฒฐํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์›๋ž˜๋ผ๋ฉด, ์ง์ ‘ SSID๋ฅผ ์ž…๋ ฅํ•ด์•ผ๋งŒ ํ•˜์ฃ . ํ•˜์ง€๋งŒ AP ๊ฒ€์ƒ‰ ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์šฐ๋ฆฌ๋Š” ์ด๋ ‡๊ฒŒ ๋””๋ฐ”์ด์Šค์—..

2020. 1. 22. 17:53

[Spring Cloud] - 5. Zuul Gateway๋ฅผ ์ด์šฉํ•œ Filtering

์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” Routing์— ์ด์–ด์„œ Zuul Gateway๋ฅผ ์ด์šฉํ•œ Filtering์— ๋Œ€ํ•ด์„œ ์ด์•ผ๊ธฐํ•ด๋ณด๋„๋ก ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. Filtering Spring Boot์—์„œ ํ•„ํ„ฐ๋ง์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒฝ์šฐ๋Š” PreFilter์™€ ๊ฐ™์€ ์—”๋“œํฌ์ธํŠธ์˜ ๋ณด์•ˆ ๋“ฑ์—์„œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ์ด ํ•„ํ„ฐ๋ง์„ ์ด์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” Spring Security์—์„œ ์ œ๊ณตํ•˜๋Š” JWT ๋“ฑ์˜ ๋ณด์•ˆ ์ˆ˜๋‹จ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ธ์ฆ์„ ๋ฐ›๊ณ , ์—”๋“œํฌ์ธํŠธ์— ์ ‘๊ทผํ•˜๋Š” ๋ฐฉ์‹์ด์ฃ . Zuul Gateway์—์„œ๋„ ์—”๋“œํฌ์ธํŠธ์˜ ๋ณด์•ˆ์„ ์ ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ํ•„ํ„ฐ๋ง ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ์œ„ ์•„ํ‚คํ…์ฒ˜๋Š” Zuul Gateway์˜ ์ฝ”์–ด๋ฅผ ๊ทธ๋ฆฐ ์•„ํ‚คํ…์ฒ˜์ž…๋‹ˆ๋‹ค. Zuul Servlet์„ ํ†ตํ•ด ๋“ค์–ด์˜ค๋Š” ์š”์ฒญ์„ Routing ํ•˜๊ฒŒ ๋˜๋Š”๋ฐ์š”. ๊ทธ๋ฆฌ๊ณ , ๊ทธ ๋ฐ‘๋‹จ์—๋Š” ZuulFilter Runner๊ฐ€ ์žˆ์–ด์„œ ์—”๋“œ..

2020. 1. 17. 18:55

[Spring Cloud] - 4. Zuul Gateway๋ฅผ ์ด์šฉํ•œ Routing

์ง€๋‚œ MSA ํฌ์ŠคํŠธ์— ์ด์–ด, ์ด๋ฒˆ ํฌ์ŠคํŠธ์—์„œ๋Š” Spring Cloud์—์„œ API Gateway๋ฅผ ๊ตฌํ˜„ํ•ด๋ณด๊ฒ ์Šต๋‹ˆ๋‹ค. https://blog.neonkid.xyz/205 [MSA] - 2. API Gateway๊ฐ€ ํ•„์š”ํ•œ ์ด์œ  ์•ˆ๋…•ํ•˜์„ธ์š”. ์ด๋ฒˆ ๊ธ€์€ MSA์— ๋Œ€ํ•œ ๊ธ€์„ ์ด์–ด์„œ API Gateway์— ๋Œ€ํ•œ ์ด์•ผ๊ธฐ๋ฅผ ํ•˜๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค. ์ง€๋‚œ MSA ๊ธ€์—์„œ๋Š” MSA๋ฅผ ์™œ ์จ์•ผํ•˜๋Š”์ง€, ์–ด๋–จ ๋•Œ ํ•„์š”ํ•˜๊ณ , ๋ฌด์Šจ ์žฅ๋‹จ์ ์ด ์žˆ๋Š”์ง€๋ฅผ ๊ฐ„๋žตํ•˜๊ฒŒ ์„ค๋ช…ํ•ด๋ณด๋Š” ์•„์ฃผ ์‰ฌ์šด.. blog.neonkid.xyz ํ˜น์‹œ ์ง€๋‚œ ๊ธ€์„ ์ฝ์–ด๋ณด์‹œ์ง€ ๋ชปํ–ˆ๋‹ค๋ฉด, ์œ„ ๋งํฌ๋ฅผ ํ†ตํ•ด์„œ API Gateway๊ฐ€ MSA์—์„œ ์™œ ํ•„์š”ํ•œ์ง€, ์•Œ์•„๋ณด์‹œ๊ณ  ๊ฐ€์‹ ๋‹ค๋ฉด, ์ด ํฌ์ŠคํŠธ๋ฅผ ์ดํ•ดํ•˜๋Š” ๋ฐ ๋„์›€์ด ๋  ๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ค. Gateway for Spring Cloud Spr..

[Java] - Java Stream API

Java ์–ธ์–ด๊ฐ€ ๋ฒŒ์จ 11 ๋ฒ„์ „์ด ๋‚˜์˜ค๊ณ  ์žˆ๋„ค์š”. Java๋Š” ์—ญ์‚ฌ๊ฐ€ ๊นŠ๊ณ , ์˜ค๋ž˜๋œ ์–ธ์–ด์ด์ž ๋น„๋‚œ๋„ ๋งŽ์ด ๋ฐ›์€ ์–ธ์–ด์ž…๋‹ˆ๋‹ค. ๊ทธ๋ ‡์ง€๋งŒ ์•„์ง๋„ ๋งŽ์€ ๊ณณ์—์„œ ์‚ฌ์šฉ๋˜๊ณ  ์žˆ๊ณ , ๋Œ€์ฒดํ•˜๋Š” ๊ณณ๋„ ์žˆ์Šต๋‹ˆ๋‹ค. ์˜ค๋Š˜์€ Java 8์—์„œ ๋“ฑ์žฅํ•œ Stream์— ๋Œ€ํ•ด ์ด์•ผ๊ธฐํ•ด๋ณด๊ณ ์ž ํ•ฉ๋‹ˆ๋‹ค. Stream API Stream ? ํ˜น์‹œ ๊ทธ๊ฑฐ, Buffer ๋ณด๋‹ค ์†๋„๊ฐ€ ๊ฒ๋‚˜ ๋น ๋ฅธ ๊ทธ Stream ? ๋„ค, ๊ทธ๊ฑด ์•„๋‹™๋‹ˆ๋‹ค. Java์—์„œ Stream์€ ํ•จ์ˆ˜ํ˜• ํ”„๋กœ๊ทธ๋ž˜๋ฐ์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•œ ๊ธฐ์ˆ  ์ค‘ ํ•˜๋‚˜๋กœ, Java 8์—์„œ ์ƒˆ๋กœ์ด ๋“ฑ์žฅํ•˜์˜€์Šต๋‹ˆ๋‹ค. Java 8 ์ด์ „์—๋Š” ๋ฐฐ์—ด์ด๋‚˜ Collections์˜ ์ž๋ฃŒ ๊ตฌ์กฐ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‹ค๋ฃจ๊ธฐ ์œ„ํ•ด for ๋ฌธ์ด๋‚˜ foreach ๋ฌธ์„ ์‚ฌ์šฉํ•˜์—ฌ ์š”์†Œ๋ฅผ ํ•˜๋‚˜์”ฉ ๊บผ๋‚ด์—ˆ์ง€์š”. ๊ฐ„๋‹จํ•œ ์•Œ๊ณ ๋ฆฌ์ฆ˜์„ ์งœ๋Š” ๊ฒƒ์ด๋ผ๋ฉด, ํฐ ์ƒ๊ด€์ด ์—†..