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

Programming/Java

[Java] modelmapper jdk 17 issue "modelmapper Unable to make field private final java.time.LocalDate java.time.LocalDateTime.date accessible: module java.base does not "opens java.time" to unnamed module" ํ•ด๊ฒฐ

728x90
๋ฐ˜์‘ํ˜•

java spring ํ™˜๊ฒฝ์—์„œ modelmapper ๋ฅผ ์‚ฌ์šฉํ•˜๋˜ ์ค‘ ์•„๋ž˜์™€ ๊ฐ™์€ ์ด์Šˆ๊ฐ€ ๋ฐœ์ƒ

"modelmapper Unable to make field private final java.time.LocalDate java.time.LocalDateTime.date accessible: module java.base does not "opens java.time" to unnamed module"

 

Java 9๋ถ€ํ„ฐ๋Š” ๋ชจ๋“ˆ ์‹œ์Šคํ…œ์ด ๋„์ž…๋˜์—ˆ์œผ๋ฉฐ, ๋ชจ๋“ˆ ๊ฐ„์˜ ์ ‘๊ทผ์„ ๋ช…์‹œ์ ์œผ๋กœ ์ œ์–ดํ•˜๊ฒŒ ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์ด ๋ฌธ์ œ๋Š” Java 9 ์ด์ƒ์—์„œ ModelMapper์™€ java.time ํŒจํ‚ค์ง€์˜ ์‚ฌ์šฉ ์‚ฌ์ด์˜ ์ ‘๊ทผ ์ œํ•œ์œผ๋กœ ๋ฐœ์ƒํ•œ ์ด์Šˆ

 

ํ˜„์žฌ ๋‚ด ํ™˜๊ฒฝ์€ jdk 17์ด์—ˆ๊ณ  entity์˜ private์œผ๋กœ ์„ค์ •๋œ LocalDateTime ํ•„๋“œ์— modelmapper๋กœ ์ ‘๊ทผํ•˜๋‹ค๊ฐ€ ์ผ์–ด๋‚œ ๋ฌธ์ œ์ด๋‹ค.

 

์—ฌ๋Ÿฌ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์ด ์žˆ๊ฒ ์ง€๋งŒ, ๊ธฐ์กด์˜ ์ฝ”๋“œ๋ฅผ ๊ฐ€์žฅ ๊ฑด๋“œ๋ฆฌ์ง€ ์•Š๊ณ  ํ•ด๊ฒฐํ•˜๋Š” ํ™•์‹คํ•œ ๋ฐฉ๋ฒ•์€ modelmapper์˜ ๋ฒ„์ ผ์„ ์˜ฌ๋ฆฌ๋Š” ๊ฒƒ

 

์œ„ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ•œ modelmapper์˜ ๋ฒ„์ ผ์€ 2.4.4 -> 3.1.1๋กœ ์˜ฌ๋ ค์„œ ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐ

 

๋‚ด ๋นŒ๋“œํ™˜๊ฒจ์€ gradle์ด์—ˆ๊ธฐ์— build.gradle ์— dependency ๋ฅผ ์•„๋ž˜์™€ ๊ฐ™์ด ์ˆ˜์ •ํ•˜์—ฌ์„œ ํ•ด๊ฒฐํ•˜์˜€๋‹ค.

 

implementation 'org.modelmapper:modelmapper:3.1.1'

 

728x90
๋ฐ˜์‘ํ˜•