๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐ŸŒฟ Spring33

[Spring Boot/RESTful] Web Service & Web Application ์›น ์„œ๋น„์Šค ๋„คํŠธ์›Œํฌ ์ƒ์—์„œ ์„œ๋กœ ๋‹ค๋ฅธ ์ข…๋ฅ˜์˜ ์ปดํ“จํ„ฐ๋“ค ๊ฐ„์— ์ƒํ˜ธ์ž‘์šฉํ•˜๊ธฐ ์œ„ํ•œ ์†Œํ”„ํŠธ์›จ์–ด ์‹œ์Šคํ…œ SOAP VS REST 1) SOAP(Simple object access protocol) XML ๊ธฐ๋ฐ˜ envelope - header - body๋กœ ๊ตฌ์„ฑ๋˜์–ด ์žˆ์Œ -> overhead ์‹ฌํ•จ 2) REST(REpresentational State Transfer) Resource์˜ representation์— ์˜ํ•œ (์ž์›์˜) ์ƒํƒœ ์ „๋‹ฌ HTTP Method๋ฅผ ํ†ตํ•ด Resource๋ฅผ ์ฒ˜๋ฆฌํ•˜๊ธฐ ์œ„ํ•œ ์•„ํ‚คํ…์ณ RESTful : REST API๋ฅผ ์ œ๊ณตํ•˜๋Š” ์›น ์„œ๋น„์Šค REST HTTP HTTP Methods : ํด๋ผ์ด์–ธํŠธ๊ฐ€ ์„œ๋ฒ„์—๊ฒŒ ์ „๋‹ฌํ•˜๊ฒŒ ๋˜๋Š” ๋ชฉ์ ์ด๋‚˜ ์ข…๋ฅ˜๋ฅผ ์•Œ๋ ค์ฃผ๋Š” ์ˆ˜๋‹จ HTTP Status Codes : ํด๋ผ์ด.. 2022. 2. 17.
[Error] Spring Boot(2.5x)์—์„œ data.sql ์‹คํ–‰ ์˜ค๋ฅ˜(H2 database) ์ƒํ™ฉ Spring Boot(2.5 ์ด์ƒ)์—์„œ data.sql์„ ์‹คํ–‰ํ•˜์˜€์œผ๋‚˜ h2 db์— ํ•ด๋‹น ์ฟผ๋ฆฌ๊ฐ€ ๋ฐ˜์˜๋˜์ง€ ์•Š์€ ๊ฒฝ์šฐ.(ํ…Œ์ด๋ธ”์€ ์ •์ƒ์ ์œผ๋กœ ์ƒ์„ฑ๋จ) ํ•ด๊ฒฐ application.yml์— ์•„๋ž˜ ๋‘ ์ค„ ์ถ”๊ฐ€ํ•˜๊ธฐ. ๋‹ค๋ฅธ ํฌ์ŠคํŒ…์„ ๋ณด๋ฉด defer-datasource-initialization์„ true๋กœ๋งŒ ํ•ด๋„ ๋Œ์•„๊ฐ„๋‹ค๊ณ  ํ•˜๋Š”๋ฐ, ๋‚˜๊ฐ™์€ ๊ฒฝ์šฐ sql.init.mode=always๋ฅผ ์ถ”๊ฐ€์ ์œผ๋กœ ๋„ฃ์–ด์•ผ ์ •์ƒ์ ์œผ๋กœ ์ž‘๋™ํ–ˆ๋‹ค! sql: init: mode: always jpa: defer-datasource-initialization: true 2022. 2. 2.
[Error] H2 ์ถ”๊ฐ€ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ์ƒ์„ฑ - IO Exception: null [90028-200] ์ƒํ™ฉ H2 Database Engine์„ ํ†ตํ•ด ์ƒˆ๋กœ์šด H2 ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋งŒ๋“œ๋ ค๊ณ  ํ–ˆ์„ ๋•Œ ๋ฐœ์ƒํ•˜๋Š” ์˜ค๋ฅ˜. path, username, password๋ฅผ ์˜ฌ๋ฐ”๋ฅด๊ฒŒ ๋„ฃ์—ˆ๋Š”๋ฐ๋„ ๋ถˆ๊ตฌํ•˜๊ณ  ๋ฐœ์ƒ. ํ•ด๊ฒฐ ./{dbname}์„ ~/{dbname}์œผ๋กœ ๋ฐ”๊พธ์–ด์ฃผ์—ˆ๋”๋‹ˆ ๋ฐ”๋กœ ์ƒ์„ฑ๋˜์—ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ์›๋ž˜๋ผ๋ฉด ~/{dbname}๊ณผ ./{dbname} ๋ชจ๋‘ ์ƒ์„ฑ์ด ์ž˜ ๋˜์–ด์•ผ ํ•˜๋Š” ๊ฒƒ์ด ๋งž๋‹ค. ์ฐจ์ด ~/ : user ํด๋”์— ์ƒ์„ฑ ./ : h2 bin ํด๋”์— ์ƒ์„ฑ ๋น„๋ฐ€๋ฒˆํ˜ธ ์ˆ˜์ •ํ•˜๋Š” ๋ฒ• ALTER USER {์œ ์ €๋ช…} SET PASSWORD '(๋ณ€๊ฒฝ๊ฐ’)'; 2022. 1. 30.
[Error] GenerationType.IDENTITY - ERROR: NULL not allowed for column "ID"; SQL statement: ์ƒํ™ฉ ํ…Œ์ด๋ธ” ์ƒ์„ฑ๊ณผ Insert ์ฟผ๋ฆฌ๋Š” ์ž˜ ์ž‘๋™ํ•˜๋‚˜ ์‹ค์ œ ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค๋ฅผ ๋ณด๋ฉด ๊ฐ’์ด ์—†๋Š” ํ˜„์ƒ ํ•ด๊ฒฐ h2 ์ตœ์‹  ๋ฒ„์ „์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ์–ด์„œ ๋ฐœ์ƒํ•˜๋Š” ๋ฌธ์ œ๋ผ๊ณ  ํ•œ๋‹ค. 1.4.200 ๋ฒ„์ „์„ ๋‹ค์šด๋ฐ›์œผ๋ฉด ๋œ๋‹ค. ๊ธฐํƒ€ ์˜ค๋ฅ˜ +a) 1.4.200 installer๋ฅผ ๋‹ค์šด๋ฐ›์•˜๋Š”๋ฐ๋„ ํ•ด๊ฒฐ๋˜์ง€ ์•Š๋Š” ๊ฒฝ์šฐ -> ์—ฌ์ „ํžˆ ์ตœ์‹  ๋ฒ„์ „์œผ๋กœ ๋˜์–ด ์žˆ์„ ํ™•๋ฅ ์ด ๋†’๋‹ค 1) ํ˜„์žฌ ๋ฒ„์ „ ํ™•์ธ SELECT H2VERSION() FROM DUAL 2) C:\Users\{username}์—์„œ .h2.server.properties์™€ test.mv.db ์‚ญ์ œ 3) C:\Program Files (x86)\h2\bin์—์„œ zipํŒŒ์ผ ๋ฒ„์ „ ํ™•์ธ ํ›„ ํ•ด๋‹น ํด๋” ์‚ญ์ œ -> ํ™ˆํŽ˜์ด์ง€์—์„œ installer ์žฌ์„ค์น˜ => h2๋ฅผ ์‚ญ์ œํ•  ๋•Œ (3)๋ฒˆ ์œ„์น˜์— ์žˆ๋Š” ํŒŒ์ผ.. 2022. 1. 30.