|
|
@ -23,7 +23,6 @@ import javax.lang.model.element.Modifier; |
|
|
|
|
|
|
|
|
|
|
|
import jakarta.persistence.Convert; |
|
|
|
import jakarta.persistence.Convert; |
|
|
|
import jakarta.persistence.Converter; |
|
|
|
import jakarta.persistence.Converter; |
|
|
|
import jakarta.persistence.Embedded; |
|
|
|
|
|
|
|
import jakarta.persistence.EntityListeners; |
|
|
|
import jakarta.persistence.EntityListeners; |
|
|
|
import jakarta.persistence.IdClass; |
|
|
|
import jakarta.persistence.IdClass; |
|
|
|
import jakarta.persistence.PostLoad; |
|
|
|
import jakarta.persistence.PostLoad; |
|
|
@ -200,16 +199,22 @@ class PersistenceManagedTypesBeanRegistrationAotProcessor implements BeanRegistr |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
ReflectionHints reflection = hints.reflection(); |
|
|
|
ReflectionHints reflection = hints.reflection(); |
|
|
|
|
|
|
|
registerInstantiatorForReflection(reflection, |
|
|
|
|
|
|
|
AnnotationUtils.findAnnotation(managedClass, embeddableInstantiatorClass)); |
|
|
|
ReflectionUtils.doWithFields(managedClass, field -> { |
|
|
|
ReflectionUtils.doWithFields(managedClass, field -> { |
|
|
|
Embedded embeddedAnnotation = AnnotationUtils.findAnnotation(field, Embedded.class); |
|
|
|
registerInstantiatorForReflection(reflection, |
|
|
|
if (embeddedAnnotation != null && field.getAnnotatedType().getType() instanceof Class<?> embeddedClass) { |
|
|
|
AnnotationUtils.findAnnotation(field, embeddableInstantiatorClass)); |
|
|
|
Annotation embeddableInstantiatorAnnotation = AnnotationUtils.findAnnotation(embeddedClass, embeddableInstantiatorClass); |
|
|
|
registerInstantiatorForReflection(reflection, |
|
|
|
if (embeddableInstantiatorAnnotation != null) { |
|
|
|
AnnotationUtils.findAnnotation(field.getType(), embeddableInstantiatorClass)); |
|
|
|
Class<?> embeddableInstantiatorClass = (Class<?>) AnnotationUtils.getAnnotationAttributes(embeddableInstantiatorAnnotation).get("value"); |
|
|
|
|
|
|
|
reflection.registerType(embeddableInstantiatorClass, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void registerInstantiatorForReflection(ReflectionHints reflection, @Nullable Annotation annotation) { |
|
|
|
|
|
|
|
if (annotation == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Class<?> embeddableInstantiatorClass = (Class<?>) AnnotationUtils.getAnnotationAttributes(annotation).get("value"); |
|
|
|
|
|
|
|
reflection.registerType(embeddableInstantiatorClass, MemberCategory.INVOKE_DECLARED_CONSTRUCTORS); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|