Hello Guys, How are you all? Hope You all Are Fine. Today I am using Lombok plugins and I am trying to use java.time.Instant library But I am facing following error Java 8 date/time type java.time.Instant
not supported by default in Java. So Here I am Explain to you all the possible solutions here.
Without wasting your time, Let’s start This Article to Solve This Error.
How This Error Occurs ?
I am using Lombok plugins and I am trying to use java.time.Instant library But I am facing following error.
Type definition error: [simple type, class java.time.Instant]; nested exception is com.fasterxml.jackson.databind.exc.InvalidDefinitionException: Java 8 date/time type `java.time.Instant` not supported by default: add Module \”com.fasterxml.jackson.datatype:jackson-datatype-jsr310\” to enable handling
How To Solve Java 8 date/time type java.time.Instant
not supported by default Error ?
- How To Solve Java 8 date/time type
java.time.Instant
not supported by default Error ?To Solve Java 8 date/time type
java.time.Instant
not supported by default Error Just add this com.fasterxml.jackson.datatype dependency in pom.xml Now, Your error should be solved. Second solution is If You are using com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in your classpath, thenJavaTimeModule
should be registered. Just adding the dependancy is not enough, you have to declare a@Bean
of you module. - Java 8 date/time type
java.time.Instant
not supported by defaultTo Solve Java 8 date/time type
java.time.Instant
not supported by default Error Just add this com.fasterxml.jackson.datatype dependency in pom.xml Now, Your error should be solved. Second solution is If You are using com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in your classpath, thenJavaTimeModule
should be registered. Just adding the dependancy is not enough, you have to declare a@Bean
of you module.
Solution 1: add this dependency in pom.xml
Just add this com.fasterxml.jackson.datatype dependency in pom.xml
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
</dependency>
Now, Your error should be solved.
Solution 2: Register JavaTimeModule
If You are using com.fasterxml.jackson.datatype.jsr310.JavaTimeModule in your classpath, then JavaTimeModule
should be registered. Just adding the dependancy is not enough, you have to declare a @Bean
of you module like follow:
@Bean
public Module dateTimeModule(){
return new JavaTimeModule();
}
Summary
It’s all About this issue. Hope all solution helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which solution worked for you?
Also, Read