โ๏ธ ์์ฌ
Spring ์๊ฒฉ ๊ฐ์ ์ค์ ์คํ๋ง์ 3๊ณ์ธต(Controller, Sevice, Repository) ์์ด
AllInOneServelet ํด๋์ค๋ฅผ ์์ฑํ์ฌ ๊ตฌํํ๊ณ , API์ ๋์์ ๊ฒ์ฆํ๊ธฐ ์ํ ์์ ์ค ํธ๋ฌ๋ธ์ ๋ง๋จ!



ARC์์ POST API๋ฅผ ๋ณด๋์ ๋, "Internal Server Error"
์๋ฌ ํ์ธ์ ์ํด์ intellij ์๋ฌ ์ฝ๋ ํ์ธ
Servlet.service() for servlet [com.sparta.springcore.AllInOneServlet] in context with path [] threw exception
์๋ฌ ์ฝ๋ ์์ ์๋ ์ ๋ฌธ์ฅ๋ง ์ ๊ฒฝ ์ฐ๋๋ผ ๊ฒฝ๋ก๊ฐ ์๋ชป๋ ์ค ์๊ณ PC ์ธ์ด ์ค์ ๋ณ๊ฒฝํด๋ณด๊ณ ๋๋ฆฌ ...
๊ฒฐ๊ตญ, ํ์๋ถ๊ป ๋์์ ์ฒญํ๋๋ฐ ..!
๋ฐ๋ก ์๋ ์ฝ๋๋ฅผ ํ์ธํ์ด์ผํ๋ค.
โ๏ธ Trouble
Java 8 date/time type `java.time.LocalDateTime` not supported by default: add Module "com.fasterxml.jackson.datatype:jackson-datatype-jsr310" to enable handling (through reference chain: com.sparta.springcore.Product["createdAt"])
โจ ํด๊ฒฐ ์ฐธ๊ณ ์๋ฃ
Is there a jackson datatype module for JDK8 java.time?
I'm looking for a module for the new JDK8 java.time classes. I have looked through the FasterXML GitHub Project Listing and presently found none. As I understand Jackson is still being compiled ag...
stackoverflow.com
โ๏ธ ์์ธ
Since Jackson 2.6.0 the "old" JSR310Module is deprecated.
It is replaced by JavaTimeModule. Maven dependency is the same (you can find the current version in Maven Central):
(๋ฒ์ญ) Jackson 2.6.0๋ถํฐ "์ด์ " JSR310Module์ ๋ ์ด์ ์ฌ์ฉ๋์ง ์์ต๋๋ค.
JavaTimeModule๋ก ๋์ฒด๋ฉ๋๋ค. Maven ์ข ์์ฑ์ ๋์ผํฉ๋๋ค(Maven Central์์ ํ์ฌ ๋ฒ์ ์ ์ฐพ์ ์ ์์).
=> Java 8 ๊ณผ์ ๋ฒ์ ๋ฌธ์ ...
โ๏ธ ํด๊ฒฐ
(1) MVN Repository์์ "Jackson Datatype" ๋ฅผ ๊ฒ์ํด์ 'build.gradle - dependencies'์ ๋ถ์ฌ์ฃผ๊ธฐ
Maven Repository: com.fasterxml.jackson.datatype » jackson-datatype-jsr310 » 2.13.0
Add-on module to support JSR-310 (Java 8 Date & Time API) data types. Note: There is a new version for this artifact com.fasterxml.jackson.datatype jackson-datatype-jsr310 2.13.0 // https://mvnrepository.com/artifact/com.fasterxml.jackson.datatype/jackson-
mvnrepository.com
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2'
(2) AllInOneServlet.java ํด๋์ค์์ ์๋ ์ฝ๋๋ฅผ ์ฐพ์์,
ObjectMapper objectMapper = new ObjectMapper();
์๋ ์ฝ๋๋ฅผ ๋ถ์ฌ์ฃผ๊ธฐ (์ฌ๋ฌ ๊ฐ ์์์)
objectMapper.registerModule(new JavaTimeModule());
โ๏ธ ํด๊ฒฐ ์๋ฃ !