์ƒˆ์†Œ์‹

Back-End/Java

[Java] IntelliJ์—์„œ lombok ์‚ฌ์šฉํ•˜๊ธฐ

  • -

 

 


Lombok์ด๋ž€ ์ž๋ฐ” ๊ฐœ๋ฐœํ•  ๋•Œ ์ž์ฃผ ์‚ฌ์šฉํ•˜๋Š” ์ฝ”๋“œ Getter, Setter, ๊ธฐ๋ณธ ์ƒ์„ฑ์ž, toString ๋“ฑ์„ ์–ด๋…ธํ…Œ์ด์…˜์œผ๋กœ ์ž๋™์ƒ์„ฑ

 

 

Lombok ์ ์šฉ ๋ฐ ์‚ฌ์šฉ


1. gradle ํ”„๋กœ์ ํŠธ ๊ธฐ์ค€์œผ๋กœ build.gradle์— ๋‹ค์Œ์˜ ์ฝ”๋“œ๋ฅผ ์ถ”๊ฐ€

2. ๋“ฑ๋ก ํ›„ Refreshํ•ด์„œ ํ•ด๋‹น ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ๋‚ด๋ ค๋ฐ›์Šต๋‹ˆ๋‹ค.

3. IntelliJ ์žฌ์‹œ์ž‘ ํ›„ Settings > Build > Compiler > Annotation Proccessors๋กœ ์ด๋™ ํ›„์— Enable annotation proccessing ์ฒดํฌ

 

 

์ฃผ์˜) lombok์€ ํ”„๋กœ์ ํŠธ๋งˆ๋‹ค ์„ค์ •์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ํ”Œ๋Ÿฌ๊ทธ์ธ์€ ํ•œ ๋ฒˆ๋งŒ ์„ค์น˜ํ•˜๋ฉด ๋˜์ง€๋งŒ, ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์ถ”๊ฐ€์™€ Enable annotation proccessing ์ฒดํฌ๋Š” ํ”„๋กœ์ ํŠธ๋งˆ๋‹ค ์ง„ํ–‰ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

Contents

ํฌ์ŠคํŒ… ์ฃผ์†Œ๋ฅผ ๋ณต์‚ฌํ–ˆ์Šต๋‹ˆ๋‹ค. ๐Ÿ˜Š

์ด ๊ธ€์ด ๋„์›€์ด ๋˜์—ˆ๋‹ค๋ฉด ๊ณต๊ฐ ๋ถ€ํƒ๋“œ๋ฆฝ๋‹ˆ๋‹ค. ๐Ÿ‘