[Spring Boot] Spring Boot 3๊ณผ Spring Boot 2 ๋น„๊ต
ยท
Backend/Spring Boot
์ด๋ฒˆ์— ํ”„๋กœ์ ํŠธ์— ์ƒˆ๋กœ ๋“ค์–ด๊ฐ€๊ฒŒ ๋˜๋ฉด์„œ, Spring Boot ๋ฒ„์ „์„ ์„ ํƒํ•ด์•ผ ๋๋‹ค. ์ž‘๋…„(23๋…„ ์ดˆ)๊นŒ์ง€๋งŒ ํ•ด๋„ ๊ต์œก์—์„œ ์šฐ๋ฆฌ ํŒ€ ๋ฟ๋งŒ์•„๋‹ˆ๋ผ, ๊ฑฐ์˜ ๋ชจ๋“  ์ฃผ๋ณ€ ํŒ€๋“ค์ด Spring 2.7 ๋ฒ„์ „์„ ์‚ฌ์šฉํ–ˆ์—ˆ๋‹ค. ์•„๋ฌด๋ž˜๋„ Spring Boot 3 (22๋…„ 11์›” ์ถœ์‹œ)์ด ๋‚˜์˜จ์ง€ ์–ผ๋งˆ ์•ˆ๋˜์–ด์„œ Deprecated ๋˜๋Š” ๊ฒƒ๋„ ๊ฝค ์žˆ์—ˆ๊ณ , ์ฐธ๊ณ  ์ž๋ฃŒ๊ฐ€ ์ƒ๋Œ€์ ์œผ๋กœ ์ ์–ด ๋‹ค๋“ค 2.7 ๋ฒ„์ „์„ ์„ ํƒํ–ˆ์—ˆ๋‹ค.         Spring Boot 2๊ฐ€ ๋‚ฎ์€ ๋ฒ„์ „๋ถ€ํ„ฐ ์ง€์›์ด ์ ์  ๋Š๊ธฐ๊ณ  ์žˆ๋‹ค. ๊ทธ๋ž˜์„œ ๊ธฐ์กด์˜ ํ”„๋กœ์ ํŠธ๋ฅผ Spring Boot 3์œผ๋กœ ์ ์ฐจ ๋งˆ์ด๊ทธ๋ž˜์ด์…˜ ํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ๋“ค์—ˆ๋‹ค.   ์ด๋ฒˆ ํ”„๋กœ์ ํŠธ์— Spring Boot 3 ๋ฒ„์ „์„ ์“ฐ๊ฒŒ ๋˜์–ด์„œ, Spring Boot 3์—์„œ ์–ด๋–ป๊ฒŒ ๋‹ฌ๋ผ์กŒ๋Š”์ง€ ์•Œ์•„๋ณด๊ณ ์ž ํ•œ๋‹ค!     Java..
[Spring Boot] Redis๋กœ ๋žญํ‚น ๊ธฐ๋Šฅ ๊ตฌํ˜„ํ•˜๊ธฐ
ยท
Backend/Spring Boot
์šด๋™ ๋ชจ์ž„ ํ”„๋กœ์ ํŠธ์—์„œ ํŒ€ ๋žญํ‚น์„ ๋งก์•„์„œ ๊ตฌํ˜„ํ–ˆ๋‹ค. ํŒ€ ๋žญํ‚น ๊ธฐ๋Šฅ์€ ์Šคํฌ์ธ  ์ข…๋ฅ˜๋งˆ๋‹ค ๊ฒฝ๊ธฐ, ์Šน, ๋ฌด, ํŒจ, ๋ ˆ์ดํŒ… ์ˆ˜๋กœ ์ •๋ ฌ๋œ ์ƒ์œ„ 10๊ฐœ์˜ ํŒ€์˜ ์ •๋ณด๋ฅผ ์ œ๊ณตํ•˜๋Š” ๊ธฐ๋Šฅ์ด๋‹ค.      ์™œ Redis์ธ๊ฐ€?  ๋žญํ‚น ๊ธฐ๋Šฅ์€ ์„œ๋น„์Šค์˜ ํ•ต์‹ฌ ๊ธฐ๋Šฅ ์ค‘ ํ•˜๋‚˜๋กœ ์กฐํšŒ๊ฐ€ ๋นˆ๋ฒˆํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋ฐ์ดํ„ฐ๊ฐ€ ๋งŽ์œผ๋ฉด ๋Š๋ ค์ง„๋‹ค๋Š” ๋ฌธ์ œ๊ฐ€ ์žˆ์—ˆ๋‹ค. ์ด์ „์—๋Š” Redis๋ฅผ ์‚ฌ์šฉํ•˜์ง€ ์•Š๊ณ , Spring Data JPA๋กœ ์กฐ๊ฑด(์šด๋™ ์ข…๋ฅ˜, ๊ฒŒ์ž„ ํƒ€์ž…, ์ •๋ ฌ ์กฐ๊ฑด)์— ํ•ด๋‹นํ•˜๋Š” RDB(MySQL)๋ฅผ ์กฐํšŒํ•˜์—ฌ ํŒ€ ๋žญํ‚น ๊ธฐ๋Šฅ์„ ๊ตฌํ˜„ํ–ˆ์—ˆ๋‹ค. `getTop10BySportsAndGameTypeOrderByPointDesc(sports, gameType)`(SQL๋กœ ORDER BY๋ฅผ ์“ด ๊ฒƒ์ด๋‚˜ ๋งˆ์ฐฌ๊ฐ€์ง€์ด๋‹ค.)   ํ•˜์ง€๋งŒ ๋ฌธ์ œ๊ฐ€ ๋žญํ‚น ์กฐํšŒ์‹œ๋งˆ๋‹ค ORDER BY ..
[Redis] Spring Boot์— Redis ์—ฐ๋™ํ•˜๊ธฐ + RedisTemplate, RedisRepository
ยท
Backend/Spring Boot
Spring์—์„œ ์ง€์›ํ•˜๋Š” Spring Data Redis๋ฅผ ํ†ตํ•ด์„œ Redis์˜ DB์™€ ์—ฐ๋™ํ•  ์ˆ˜ ์žˆ๋‹ค. Spring Data Redis๋ฅผ ํ™œ์šฉํ•˜๋ฉด ์„ค์ •๊ณผ Redis์˜ ๋ฐ์ดํ„ฐ์— ์ ‘๊ทผํ•˜๋Š” ๊ฒƒ์„ ์†์‰ฝ๊ฒŒ ํ•  ์ˆ˜ ์žˆ๋‹ค.  Redis๋ฅผ Window์— ์„ค์น˜ํ•˜๋Š” ๊ณผ์ •๊ณผ Redis ์ž๋ฃŒ๊ตฌ์กฐ์™€ ๋ช…๋ น์–ด๋Š” ๋‹ค๋ฅธ ๊ธ€์— ์žˆ์œผ๋‹ˆ ์ฐธ๊ณ ํ•˜๋ฉด ๋œ๋‹ค.      Spring Data Redis๋ฅผ ์‚ฌ์šฉํ•˜๋ ค๋ฉด `Redis 2.6` ์ด์ƒ์˜ ๋ฒ„์ „์ด ํ•„์š”ํ•˜๋‹ค.๊ทธ๋ฆฌ๊ณ  ์ด ๊ธ€์€ `Spring Boot 3.2` ๋ฒ„์ „ + `Java 17`์„ ๊ธฐ์ค€์œผ๋กœ ์ž‘์„ฑ๋˜์—ˆ๋‹ค. + `Lombok` ์ถ”๊ฐ€     ์˜์กด์„ฑ ์ถ”๊ฐ€Spring Initiaizer๋กœ ์‹œ์ž‘ํ•œ๋‹ค๋ฉด `Spring Data Redis(Access+Driver)`๋ฅผ ์ถ”๊ฐ€ํ•ด์ฃผ๋ฉด ๋œ๋‹ค.  Gradleimpleme..
[Spring Cloud] Eureka Registered instance ์ œ๊ฑฐํ•˜๊ธฐ
ยท
Backend/Spring Boot
โ“ ๋ฌธ์ œ ์ƒํ™ฉ  Spring Cloud Gateway Service๋กœ ์—ฐ๊ฒฐํ–ˆ์„ ๋•Œ ์—ฐ๊ฒฐ์ด localhost๋กœ ๋˜์—ˆ๋‹ค๊ฐ€ ์„œ๋น„์Šคํ•˜๊ณ  ์žˆ๋Š” host๋กœ ์—ฐ๊ฒฐ์ด ๋˜์—ˆ๋‹ค๊ฐ€ ํ–ˆ๋‹ค.. Eureka Service url๋กœ ๋“ค์–ด๊ฐ€์„œ Eureka์— ๋“ฑ๋ก๋œ ์•ฑ๊ณผ ์ธ์Šคํ„ด์Šค๋“ค์„ ํ™•์ธํ•˜๋‹ˆ ํ•œ ์•ฑ์— ์—ฌ๋Ÿฌ ์ธ์Šคํ„ด์Šค๋“ค์ด ๋“ฑ๋ก๋˜์–ด ์žˆ์—ˆ๋‹ค. ๋งˆ์ดํฌ๋กœ์„œ๋น„์Šค๋“ค์„ Eureka Discovery Service ์„œ๋ฒ„์— ์—ฐ๊ฒฐํ•œ์ฑ„๋กœ ์“ฐ๋‹ค๊ฐ€ ํ•œ ์„œ๋ฒ„์— ์—ฌ๋Ÿฌ ๊ฐœ์˜ ์ธ์Šคํ„ด์Šค๋“ค์ด ์ƒ์„ฑ๋˜์—ˆ๋‹ค. ์„œ๋น„์Šค๊ฐ€ ์ฃฝ์—ˆ์Œ์—๋„ DOWN์ด ๋˜์ง€ ์•Š์•˜๋‹ค. ๊ทธ๋ ‡๋‹ค๋ฉด ์ง์ ‘ ์ˆ˜๋™์œผ๋กœ ์ธ์Šคํ„ด์Šค๋ฅผ ๋‚ด๋ ค์•ผ ํ•˜๋Š”๋ฐ ์•„๋ฌด๋ฆฌ ๊ตฌ๊ธ€๋งํ•ด๋„ ๋‚ด๋ฆฌ๋Š” ๋ฐฉ๋ฒ•์„ ์ฐพ๊ธฐ๊ฐ€ ์–ด๋ ค์› ๋‹ค.         ๐Ÿ’ก ํ•ด๊ฒฐChatGPT์—๊ฒŒ ๋ฌผ์–ด์™”๋‹ค!    SpringApplication.java@SpringBootApplic..
[Spring] Spring Boot์— QueryDSL ๋„์ž…๊ธฐ
ยท
Backend/Spring Boot
์ผ๋ฐ˜์ ์œผ๋กœ Spring Boot ํ™˜๊ฒฝ์—์„œ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋ฐ, Spring Data JPA๊ฐ€ ์ œ๊ณตํ•˜๋Š” ๊ธฐ๋ณธ CRUD  ๋ฉ”์†Œ๋“œ์™€ Named Query ๋ฉ”์†Œ๋“œ๋ฅผ ์‚ฌ์šฉํ•˜๊ฒŒ ๋œ๋‹ค. ๊ทธ๋ฆฌ๊ณ  ์•ˆ๋˜๋Š” ๊ฒฝ์šฐ๋Š” JPQL์ด๋‚˜ Native Query๋กœ ์ž‘์„ฑํ•˜๊ฒŒ ๋œ๋‹ค. ํ•˜์ง€๋งŒ ๋ณต์žกํ•œ ์ฟผ๋ฆฌ ๋กœ์ง์„ ๊ฐ€์ง„ ๊ฒฝ์šฐ์—๋Š” ๋ฉ”์†Œ๋“œ๋‚˜ ์ฟผ๋ฆฌ๋ฌธ์ด ๊ธธ์–ด์ ธ์„œ ๊ฐ€๋…์„ฑ์ด ๋–จ์–ด์ง€๊ฒŒ ๋œ๋‹ค. ํŠนํžˆ Paging์ด๋‚˜ Sorting์„ ๊ตฌํ˜„ํ•˜๊ฒŒ ๋  ๊ฒฝ์šฐ, ๊ตฌํ˜„์ด ๋ณต์žกํ•ด์ง€๊ฒŒ ๋œ๋‹ค.     ๐Ÿšจ ๋ฌธ์ œ ์ƒํ™ฉ ๋‚˜์˜ ๊ฒฝ์šฐ์—๋„ ์ด์ „ ํ”„๋กœ์ ํŠธ๊นŒ์ง€ Spring Data JPA๊ฐ€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ œ๊ณตํ•˜๋Š” CRUD ๋ฉ”์†Œ๋“œ์™€ Named Query๋กœ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋กœ์ง์„ ๊ตฌํ˜„ํ–ˆ์—ˆ๊ณ , ์กฐ๊ธˆ ๋” ๋ณต์žกํ•œ ์ฟผ๋ฆฌ์˜ ๊ฒฝ์šฐ์—๋Š” ๊ฐ€๋…์„ฑ์€ ์กฐ๊ธˆ์€ ๋–จ์–ด์ง€์ง€๋งŒ Native Query๋กœ ๋ณ„ ๋ฌธ์ œ์—†์ด ๊ตฌํ˜„์„..
[Spring] TypeError: Failed to execute 'fetch' on 'Window' : Request with GET/HEAD method cannot have body.
ยท
Backend/Spring Boot
Swagger์—์„œ API๋ฅผ ํ…Œ์ŠคํŠธํ•˜๋Š”๋ฐ ์—๋Ÿฌ๊ฐ€ ๋‚ฌ๋‹ค!     ๐Ÿ’ป ์—๋Ÿฌ ๋ฉ”์‹œ์ง€Failed to execute 'fetch' on 'Window' : Request with GET/HEAD method cannot have body.     ๐Ÿ”Ž ์›์ธGet ๋ฐฉ์‹์œผ๋กœ RequestBody๋กœ ๋ณด๋‚ด๋ ค๊ณ  ํ–ˆ๋˜ ๊ฒƒ์ด ์›์ธ์ด์—ˆ๋‹ค. ์•„๋ฌด ์ƒ๊ฐ์—†์ด ์กฐํšŒ๋‹ˆ๊นŒ Get๋ฐฉ์‹์œผ๋กœ ํ•ด์•ผ์ง€~ ํ–ˆ๋‹ค.. @GetMapping("/one") public ResponseEntity list(@RequestBody TicketReq ticketReq) { try { List list = ticketService.getTicketList(ticketReq); if (list != nul..
giraffe_
'Backend/Spring Boot' ์นดํ…Œ๊ณ ๋ฆฌ์˜ ๊ธ€ ๋ชฉ๋ก (2 Page)