1. ๊ฐ๊ธ์ ์ด๋ฉด setter ์ฌ์ฉํ์ง ๋ง์. - ๋ณ๊ฒฝ ํฌ์ธํธ๊ฐ ๋ง์์ ์ ์ง๋ณด์๊ฐ ์ด๋ ค์์ง 2. ๋ชจ๋ ์ฐ๊ด๊ด๊ณ๋ ์ง์ฐ๋ก๋ฉ์ผ๋ก ์ค์ - LAZY๋ก ์ค์ !!! EX) @ManyToOne(fetch = FetchType.LAZY) 3. ์ปฌ๋ ์ ๋ฐ๋ก๋ฐ๋ก ์ธํ (์ ์ธ๊ณผ ๋์์ ์ด๊ธฐํ) - null ๋ฌธ์ ๋ฐฉ์ง ์ํด 4. ์๋ฐฉํฅ ์ฐ๊ด์ผ๋๋ ์ฐ๊ด๊ด๊ณ ํธ์ ๋ฉ์๋๋ฅผ ํตํด ๊ฐ ์ธํ - ์ฐ๊ด๊ด๊ณ์ ์ฃผ์ธ๋ง ๊ฐ์ ๊ฐ์ง๊ณ ์์ ์๋ ์์ผ๋ฏ๋ก (DB์๋ ์ฃผ์ธ๋ง ๊ฐ์ ธ๋ ok) 5. ์ต๋ํ ์ด๋์์ dependency์์ด ์์ํ๊ฒ ๋๋๊ธฐ(ํต์ฌ ๋น์ฆ๋์ค ๋ก์ง๋ง! ํ๋ฉด ๊ด๋ จ ๋ก์ง์ Form ๊ฐ์ฒด ๋๋ DTO ์ฌ์ฉ) +) manytomany๋ ์ ๋งํ๋ฉด ์ฌ์ฉx, ์ผ๋๋ค, ๋ค๋์ผ๋ก ๋๋๊ธฐ +) API ๋ง๋ค๋์๋ ์ ๋ ์ํฐํฐ๋ฅผ ์ธ๋ถ๋ก ๋ฐํ(๋ ธ์ถ)..
(Mac) getter/setter ์์ฑ -control + enter ์ธ๋ฏธ์ฝ๋ก ์๋์์ฑ command + shift + enter ๋ผ์ด๋ธ๋ฌ๋ฆฌ import option + enter ํ ์คํธ ํด๋์ค ๋ง๋ค๊ณ ์ถ์ ๊ฒฝ์ฐ - ํด๋น ํด๋์ค์์ command + shift + t ์ด์ ๋์ ๋ค์ ์คํ - control + R ์ด์ ์ ๋ค์ด๊ฐ๋ ํ์ผ ๋ชฉ๋ก - command + e ๊ฐ์ฒด ์๋์์ฑ - command + option + v ๋ฉ์๋ ์ถ์ถ - ๋ฉ์๋๋ก ๋ง๋ค๊ณ ์ถ์ ๋ถ๋ถ ๋๋๊ทธ ํ command + option + M ์ํ๋ ์ฝ๋ ํ ๋ณต์ฌ + ๋ถ์ฌ๋ฃ๊ธฐ - ๋ณต์ฌ์ํ๋ ํ ์ปค์ ์ฌ๋ฆฐ ํ , command + d
๋ค๋ฅธ ํฌํธ๋ฒํธ๋ฅผ ์ฌ์ฉํ๋ ๋ ์๋ฒ๊ฐ ํต์ ์ ํ ๋ ์๊ธฐ๋ ๋ณด์์๋ฌ์ด๋ค. React์์ axios๋ก ํผ ์ ์ก์, React axios.defaults.withCredentials = true; Flask pip install flask_cors ๋ชจ๋ ์ค์น ํ app = Flask(__name__) CORS(app, supports_credentials=True) # ๋ค๋ฅธ ํฌํธ๋ฒํธ์ ๋ํ ๋ณด์ ์ ๊ฑฐ api = Api(app) ์์ ๊ฐ์ด ์จ์ฃผ๋ฉด ํด๊ฒฐ๋๋ค!! ๋ค๋ฅธ ํฌํธ๋ผ๋ฆฌ ํต์ ํ ๋ ์ฟ ํค๊ฐ์ด ์๋์ผ๋ก ์ถ๊ฐ๋์ง์์ ์๊ธฐ๋ ๋ฌธ์ ์๋ค.
flask ์น์๋ฒ์ aws s3๋ฒํท์ ์ฐ๊ฒฐ์ํค๊ธฐ ์ํด ํ์ด์ฌ ํ์ผ์ ๋ฐ๋ก ์์ฑํ๋ค. pip install boto3 config.py ์์ฑ (AWS ๋ด ๋ณด์ ์๊ฒฉ์ฆ๋ช ์์ ํค ์ป์ด์ค๊ธฐ) AWS_ACCESS_KEY = "์์ฑ" AWS_SECRET_KEY = "์์ฑ" BUCKET_NAME = "๋ฒํท์ด๋ฆ" AWS S3 bucket ํ์ผ ์ ๋ก๋ ๋ฐ url ๊ฐ์ ธ์ค๊ธฐ - upload_file ํจ์์ ๋งค๊ฐ๋ณ์ file_path๋ ๋ด ๋ก์ปฌ ํ๊ฒฝ ๋ด์ ๋ง๋ค์ด์ง ์ด๋ฏธ์ง๊ฐ ์ ์ฅ๋ ์๋๊ฒฝ๋ก ์ด๋ค. ํด๋น ๊ฒฝ๋ก์ ์ด๋ฏธ์ง๋ฅผ s3 bucket์ ์ฌ๋ ค image url์ ์ป์ด์ค๊ธฐ ์ํด ํจ์๋ฅผ ๋ฐ๋ก ๊ตฌํํ์๋ค. import boto3 from config import * from botocore.exceptions import Clien..
dependencies { ... //lombok implementation 'org.projectlombok:lombok' annotationProcessor 'org.projectlombok:lombok' ... } dependencies ๋ด๋ถ์ ์ ์ฝ๋๋ฅผ ๋ฐ๋์ ์ถ๊ฐํด์ฃผ์ด์ผ ํ๋ค. (+ intellij lombok ํ๋ฌ๊ทธ์ธ ์ค์น) ๋์ค ์ ๋ถ ๊ผญ ์จ์ฃผ์ด์ผํ๋ค. ํนํ ๋๋ฒ์งธ ์ค ์ฝ๋๋ฅผ ๋นผ๋จน์ผ๋ฉด ์๋๋ค. ์ฒซ ์ค๋ง ์ ์ด๋ import๋ ๊ฐ๋ฅํ์ง๋ง ์ด๋ ธํ ์ด์ ์ ์ ๋๋ก ์ฌ์ฉํ ์ ์๋ค. (์ด๊ฒ๋๋ฌธ์ cannot find symbol ์๋ฌ๋์ ํ์ฐธ ํค๋งธ๋ค.)
์ผ๋จ ๋ gradle project๋ก ์งํํ์๋ค. https://start.spring.io/ ๋ฅผ ํตํด ํ๋ก์ ํธ๋ฅผ ์์ฑํ ํ, build.gradle์์ implementation('org.springframework.boot:spring-boot-starter-data-mongodb') ๋ฅผ ์ถ๊ฐํด์ค๋ค. ๋ํ swagger์ swagger ui๋ฅผ ์ฌ์ฉํ๊ธฐ ์ํด //swagger //https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2' implementation group: 'io.spr..