Skip to content

Allow overriding DateTimeProvider via Bean Definition #3177

Open
@ZIRAKrezovic

Description

@ZIRAKrezovic

The default DateTimeProvider is set to CurrentDateTimeProvider.INSTANCE which returns LocalDateTime.now().

We have to override it when using OffsetDateTime as JPA will throw an error.

According to https://docs.spring.io/spring-data/jpa/reference/auditing.html#jpa.auditing.configuration it is already possible to override AuditorAware by simply defining a bean.

However, the same is not true for DateTimeProvider. I have tried defining a bean of type DateTimeProvider, but it was not picked up. I was only able to specify it via @EnableJpaAuditing(dateTimeProviderRef = "...")

(note, I used EnableJpaAuditing, but AuditingHandlerSupport is part of spring-data-commons)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions