auto-applied AttributeConverter isn't created by CDI

Description

Since JPA 2.2, AttributeConverter-s should support CDI injection (see also ). This doesn't seem to work when I rely on the converter being auto-applied, like this:

This is basically Example 2: Auto-apply conversion of a basic attribute from the javadoc of @javax.persistence.Convert, so there should be nothing wrong with it. Yet, the utils field in MyAttributeConverter is null when the converter is invoked.

However, if I apply the converter explicitly:

then it works just fine.

I'm no expert on JPA or CDI, but I believe auto-applied converters should support CDI as well.

As a reproducer, I'm attaching a simple Maven project which produces a WAR. I then deploy the WAR into WildFly 18.0.0.Final, which includes Hibernate ORM 5.3.12.Final (a reasonably up-to-date version).

Environment

WildFly 18.0.0.Final, which includes Hibernate ORM 5.3.12.Final

Status

Assignee

Unassigned

Reporter

Ladislav Thon

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure