๐ Java & Kotlin & Spring/- Spring Cloud13 [Spring Cloud Config] Application์ ์ค์ ์ ๋ณด (application.yml) ๋ฅผ ์ค์์์ ๊ด๋ฆฌํ๊ธฐ (by native repository) ํด๋น ๊ธ์ Spring Cloud Netflix Eureka ์ Spring Cloud Gateway ์ Built-in Route๋ก Predicates์ Filter ์กฐ์ํ๊ธฐ)์ ์์กดํ๋ ๊ธ์ ๋๋ค. ์ค์ต ํ๊ฒฝ์ ๋ฐ๋ผํ์๋ ค๋ฉด Eureka์ Gateway ๊ธ์ ๋์จ ์ค์ต์ ๋ฐ๋ผํ์๊ธธ ๊ถ๊ณ ๋๋ฆฝ๋๋ค. ๋ชฉ์ฐจ Gartner ์์ ์ ์๋ MSA ํ์ค ๊ตฌ์ฑ ์์์ธ Config Store Server ์์ฃผ ๋ณ๊ฒฝ๋๋ ์ค์ ์ ๋ณด๋ ์ค์ ์ ๋ณด๋ง ๋ด๊ณ ์๋ ์๋ฒ์์ ๊ด๋ฆฌํ๊ณ ์ด๋ฅผ ํ์๋ก ํ๋ ์๋ฒ์๊ฒ ๊ฐ๊ฐ ๋ฟ๋ ค์ฃผ๋ ๋ฐฉ์ ์ฐ๋ฆฌ๊ฐ ๊ตฌ์ฑํ ์๋น์ค ๊ตฌ์กฐ ๊ฐ๊ฐ์ application.yml ์๋น์ค ๊ตฌ์กฐ์ ๋ฌธ์ ์ Spring Cloud Config ๋? ์ค์ต Spring Cloud Config ํ๋ก์ ํธ ์์ฑํ๊ธฐ @EnableConfig.. 2021. 4. 27. [Spring Cloud Gateway] Custom Filter ๋ก ๊ฐ๋จํ Authentiction ํํฐ ๋ง๋ค๊ณ ์ธ์ฆ ์ฒ๋ฆฌํ๊ธฐ ํด๋น ๊ธ์ Spring Cloud Gateway ์ Built-in Route๋ก Predicates์ Filter ์กฐ์ํ๊ธฐ) ์ ์์กดํ๋ ๊ธ์ ๋๋ค. ์ค์ต ํ๊ฒฝ์ ๋ฐ๋ผํ์๋ ค๋ฉด ์ด์ ๊ธ์ ํ์ธํ์๊ธธ ๋ฐ๋๋๋ค. ํ์ฌ ๊ธ์์๋ ๋ชจ๋ ์ธ์ฆ ๊ณผ์ (jwt ํ ํฐ์ ๋ฐ๊ธํ๊ณ payload ์ ๊ฐ์ ๋ฃ๋ ์ค์ ๊ตฌํ)์ ํ์ง ์์ต๋๋ค. ์ด๋ฒ ๊ธ์ ๋ชฉ์ ์ Gateway ์์ Custom Filter ๋ง๋ค์ด์ ํ ํฐ ๊ฒ์ฆ์ ์ํํ๋ ์ ์ฒด์ ์ธ ํฐ ๊ทธ๋ฆผ๋ง ๋ณด์ฌ์ฃผ๋ ค ํ๊ธฐ ๋๋ฌธ์ ์ค์ ์ธ์ฆ์ ๊ตฌํํ๋ ค ํ๋ค๋ฉด ์ฐธ๊ณ ๋ง ํ์๊ธธ ๋ฐ๋๋๋ค. ๋ชฉ์ฐจ Custom Filter AbstractGatewayFilterFactory ์์๊ณผ apply ์ฌ์ ์ ๊ฒ์ฆํ๊ธฐ Custom Filter ์ง๋ ์๊ฐ๊น์ง ์ฐ๋ฆฌ๋ Spring Cloud Gateway๊ฐ ๊ธฐ.. 2021. 4. 25. Spring Cloud Gateway ์์ Built-in Route๋ก Predicates์ Filter ์กฐ์ํ๊ธฐ ํด๋น ๊ธ์ SGC๋ฅผ ์ด์ฉํด API Gateway๋ฅผ ๊ตฌ์ฑํ๊ณ Eureka Server ๋ฅผ ์ด์ฉํด Load Balancing ํ๊ธฐ) ์ ์์กดํ๋ ๊ธ์ ๋๋ค. ์ค์ต ํ๊ฒฝ์ ๋ฐ๋ผํ์๋ ค๋ฉด ์ด์ ๊ธ์ ํ์ธํ์๊ธธ ๋ฐ๋๋๋ค. ๋ชฉ์ฐจ Spring Cloud Gateway Routes, Predicates, Filters Route Predicates Built-in Factories ์ฌ์ฉํ๊ธฐ After Cookie Method Path Route Filters AddRequestHeader, AddResponseHeader AddRequestParameter RewritePath Spring Cloud Gateway ์์๋ Predicates์ Filter๋ฅผ ์กฐ์ํ๋ ๋ฐฉ๋ฒ์ application.yml ์ ์ด์ฉํ short.. 2021. 4. 24. Spring Cloud Gateway ๋ฅผ ์ด์ฉํด API Gateway๋ฅผ ๊ตฌ์ฑํ๊ณ ์ค์ตํด๋ณด์ (Eureka Server ๋ฅผ ์ด์ฉํด Load Balancing ํ๊ธฐ) ํด๋น ๊ธ์ Spring Cloud Netflix Eureka์ ์์กดํ๋ ๊ธ์ ๋๋ค. ์ค์ต ํ๊ฒฝ์ ๋ฐ๋ผํ์๋ ค๋ฉด Eureka ๊ธ์ ํ์ธํ์๊ธธ ๋ฐ๋๋๋ค. ๋ชฉ์ฐจ Gateway Pattern Gateway๊ฐ ๋์ ๋๋ฉด? Spring Cloud Gateway Gateway๊ฐ ๋์ํ๋ ๋ฐฉ๋ฒ Gateway ๋ด๋ถ ๊ตฌ์กฐ ์ค์ตํ๊ธฐ ํ๋ก์ ํธ ์์ฑํ๊ธฐ ์์กด์ฑ ๋ง์ดํฌ๋ก์๋น์ค ์ฐ๊ฒฐํ๊ธฐ Eureka Server ์์ ๊ฐ๊ฐ ์ธ์คํด์ค ์ ๋ณด๋ฅผ ๋ฐ์ ๋ก๋๋ฐธ๋ฐ์ฑ ํ๊ธฐ Gateway Pattern Microservice ์์ Gateway ํจํด์ ๊ฐ์ฅ ํํ๊ณ ์ ์ฉํ๊ฒ ์ฐ๋ ํจํด ์ค ํ๋์ด๋ค. Spring Cloud์ ๋ณ๊ฐ๋ก Gateway ํจํด์ ๋ํ ์์ธํ ์ฌํญ์ MSA์ ํต์ฌ ๊ตฌ์ฑ ์์ - API Gateway ํจํด ์์ ํ์ธํ ์ ์์ต๋๋ค. .. 2021. 4. 24. ์ด์ 1 2 3 4 ๋ค์