I'm using Spring boot with mongodb. I used LocalDateTime
type for createdAt
key. This is sample code to explain my situation.
@Data
@NoArgsConstructor
@Document("User")
public class User {
@Id
private ObjectId id;
@CreatedDate
private LocalDateTime createdAt;
@LastModifiedDate
private LocalDateTime updatedAt;
private String username;
Then, spring boot throw following error.
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make private java.time.LocalDateTime(java.time.LocalDate,java.time.LocalTime) accessible: module java.base does not "opens java.time" to unnamed module
Why this error is occured, and how can I fix it?
I'm using java-17-amazon-corretto
. If you need more information, I'll add it.