Spring Boot/๊ฐ๋ฐ ๊ธฐ๋ก8 Spring Cacheable์ ๋์ ์๋ฆฌ Cacheable ์ด๋Spring์์๋ ๊ฐ๋จํ๊ฒ ์ด๋ ธํ ์ด์ ์ ๊ธฐ๋ฐ์ผ๋ก ์บ์ฑ ์ ๋ต์ ์ฌ์ฉํ ์ ์๋ ๊ธฐ๋ฅ์ ์ ๊ณตํ๋ค.๊ฐ ์บ์ ๋ฒค๋์ฌ์์ ์ ๊ณตํ๋ CacheManager๋ฅผ ๋น์ผ๋ก ๋ฑ๋กํ๊ณ ์ํ๋ ๋ฉ์๋์ ์ด๋ ธํ ์ด์ ์ ๋ฌ๋ฉด ๋ค์ํ ์บ์ ์ ์ฅ์๋ฅผ ๋์ผํ ์ธํฐํ์ด์ค๋ฅผ ํตํด ์ฌ์ฉํ ์ ์๋ค.๊ฐ๋จํ ์ฌ์ฉ ๋ฐฉ๋ฒRedis๋ฅผ ์ฌ์ฉํ๋ ๊ฐ๋จํ ์ฌ์ฉ ๋ฐฉ๋ฒ์ ์๊ฐํ๋ค. ๋จผ์ , Spring Data Redis์ ๋ํ ์์กด์ฑ์ ์ถ๊ฐํ๋ค.implementation 'org.springframework.boot:spring-boot-starter-data-redis' ๊ทธ๋ฆฌ๊ณ ์๋์ ๊ฐ์ด Configuration์ Redis์ ์ฐ๊ฒฐ์ ์ํ RedisConnectionFactory์ RedisCacheManager์ ๋น์ ๋ฑ๋กํ๋ค.@Co.. 2024. 9. 22. Spring Boot ๋ฌด์ค๋จ ๋ฐฐํฌํ๊ธฐ (AWS ec2 + Nginx + Github self -hosted runner) ๋ค์ด๊ฐ๋ฉฐ ์ค๋ฌด์ ์ ์ฉํ๋ ํ๋ก์ ํธ๊ฐ ์๋ ๊ฐ๋จํ ์ฌ์ด๋ ํ๋ก์ ํธ๋ฅผ ๋ฐฐํฌํ๋ ๊ฒฝ์ฐ์๋ ๋ค์ํ ๋ฐฉ์์ ์ฌ์ฉํ ์ ์๋ค. ๊ฐ์ฅ ๊ฐ๋จํ ๋ฐฐํฌ ๋ฐฉ์์ Github Action์ ์ด์ฉํด ๋ธ๋์น๊ฐ ํธ์๋๋ฉด ๊ธฐ์กด ํ๋ก๊ทธ๋จ์ ์ข ๋ฃํ๊ณ ์๋ก์ด ํ๋ก๊ทธ๋จ์ ๋ค์ ๋์ฐ๋ ๋ฐฉ์์ผ ๊ฒ์ด๋ค. ํ์ง๋ง ๊ธฐ์กด ํ๋ก๊ทธ๋จ์ด ์ข ๋ฃ๋๊ณ ์๋ก์ด ํ๋ก๊ทธ๋จ์ ๋์ฐ๋ ์ฌ์ด์ ์๋น์ค๊ฐ ์ค๋จ๋๊ธฐ ๋๋ฌธ์, ์ด๋ฌํ ์ค๋จ ์์ด ๋ฐฐํฌํ ์ ์๋ ๋ฌด์ค๋จ ๋ฐฐํฌ ๋ฅผ ํ๊ณ ์ ํ๋ค. ๋ฌด์ค๋จ ๋ฐฐํฌ๋ฅผ ์งํํ๊ธฐ ์ํด Blue/Green ๋ฐฐํฌ ๋ฐฉ์์ ์ฌ์ฉํ๊ณ ์ ํ๋ค. Blue/Green ๋ฐฐํฌ ๋ฐฉ์์ ์๋ ๋ฒ์ ์ผ๋ก ์คํ์ค์ธ WAS๊ฐ ์กด์ฌํ๋ค๋ฉด ํด๋น WAS๋ฅผ ์ข ๋ฃ์ํค์ง ์์ ์ฑ ์๋ก์ด ๋ฒ์ ์ WAS๋ฅผ ๊ตฌ๋์ํจ๋ค. ์ฑ๊ณต์ ์ผ๋ก ๊ตฌ๋๋์๋ค๋ฉด Nginx๊ฐ ์๋ก์ด ๋ฒ์ ์ WAS๋ฅผ ๋ฐ๋ผ๋ณด๊ฒ .. 2024. 3. 11. Spring Boot์ Spring Security ํ๋ก์ ํธ์ Swagger ์ ์ฉํ๊ธฐ ์ด๊ธ์ ๋ชฉ์ ์ ํ๋ก์ ํธ API ๊ฐ๋ฐ์ ์ด๋์ ๋ ๋ง์น๊ณ Swagger๋ฅผ ์ ์ฉํ๋ ๋ฐฉ๋ฒ์ ์ ๋ฆฌํ๋ ๊ฒ์ด๋ค. ์ ์ฉํ๊ธฐ์ ์์ ์ด ํ๋ก์ ํธ๋ Spring Boot 2.6.2์ Spring Security๊ฐ ์ ์ฉ๋์๋ค. 1. build.gradle์ ์์กด์ฑ ์ถ๊ฐ //for Swagger implementation group: 'io.springfox', name: 'springfox-swagger2', version: '2.9.2' implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2' 2. SwaggerConfig ํด๋์ค ์์ฑ config ํจํค์ง ๋ด์ SwaggerConfig ํด๋์ค๋ฅผ ์์ฑํด์ค ๋ค ๋ค์๊ณผ ๊ฐ์ด ์ฝ๋๋ฅผ.. 2022. 6. 10. [Spring Security] JWT Tutorial (5) ํ์๊ฐ์ , ๊ถํ ๊ฒ์ฆ SecurityUtil ํด๋์ค ์์ฑ package com.oliviarla.tutorial.util; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import java.util.Optional; public class SecurityUtil { private static final Logger logger.. 2022. 4. 28. [Spring Security] JWT Tutorial (4) Repository ์์ฑ, ๋ก๊ทธ์ธ DTO ๊ณ์ธต ์์ฑ LoginDto package com.oliviarla.tutorial.dto; import lombok.*; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; @Getter @Setter @Builder @AllArgsConstructor @NoArgsConstructor public class LoginDto { @NotNull @Size(min = 3, max = 50) private String username; @NotNull @Size(min = 3, max = 100) private String password; } TokenDto package com.oliviarla.. 2022. 4. 28. [Spring Security] JWT Tutorial (3) JWT ์ฝ๋, Security ์ค์ ์ถ๊ฐ application.properties jwt.header=Authorization jwt.secret=4oCYb2xpdmlhcmxhLXNwcmluZy1ib290LWp3dC10dXRvcmlhbC1zZWNyZXQtb2xpdmlhcmxhLXNwcmluZy1ib290LWp3dC10dXRvcmlhbC1zZWNyZXTigJkK jwt.token-validity-in-seconds=86400 secret ํญ๋ชฉ์ ํฐ๋ฏธ๋ ๋ช ๋ น์ด๋ก secret key๋ฅผ base64๋ก ์ธ์ฝ๋ฉํด ์ฑ์๋ฃ์ echo ‘silvernine-tech-spring-boot-jwt-tutorial-secret-silvernine-tech-spring-boot-jwt-tutorial-secret’|base64 build.gradle compileOn.. 2022. 4. 28. ์ด์ 1 2 ๋ค์