Browse Source

Avoid attempt to create property accessor for array and inaccessible types.

Original Pull Request: #3318
pull/3357/head
Christoph Strobl 3 months ago
parent
commit
947f9c45d9
No known key found for this signature in database
GPG Key ID: E6054036D0C37A4B
  1. 10
      src/main/java/org/springframework/data/aot/AotMappingContext.java

10
src/main/java/org/springframework/data/aot/AotMappingContext.java

@ -15,6 +15,8 @@
*/ */
package org.springframework.data.aot; package org.springframework.data.aot;
import java.lang.reflect.InaccessibleObjectException;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.springframework.data.mapping.Association; import org.springframework.data.mapping.Association;
@ -53,9 +55,10 @@ class AotMappingContext extends
*/ */
public void contribute(Class<?> entityType) { public void contribute(Class<?> entityType) {
try {
BasicPersistentEntity<?, AotPersistentProperty> entity = getPersistentEntity(entityType); BasicPersistentEntity<?, AotPersistentProperty> entity = getPersistentEntity(entityType);
if (entity != null) { if (entity != null && !entity.getType().isArray()) {
EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity); EntityInstantiator instantiator = instantiators.getInstantiatorFor(entity);
if (instantiator instanceof EntityInstantiatorSource source) { if (instantiator instanceof EntityInstantiatorSource source) {
@ -64,6 +67,11 @@ class AotMappingContext extends
propertyAccessorFactory.initialize(entity); propertyAccessorFactory.initialize(entity);
} }
} catch (InaccessibleObjectException exception) {
if(logger.isInfoEnabled()) {
logger.info("Unable to contribute bytecode accessor for [%s]".formatted(entityType), exception);
}
}
} }
@Override @Override

Loading…
Cancel
Save