38
38
import org .springframework .context .ApplicationEventPublisher ;
39
39
import org .springframework .context .ApplicationEventPublisherAware ;
40
40
import org .springframework .core .KotlinDetector ;
41
+ import org .springframework .core .NativeDetector ;
41
42
import org .springframework .data .mapping .MappingException ;
42
43
import org .springframework .data .mapping .PersistentEntity ;
43
44
import org .springframework .data .mapping .PersistentProperty ;
86
87
public abstract class AbstractMappingContext <E extends MutablePersistentEntity <?, P >, P extends PersistentProperty <P >>
87
88
implements MappingContext <E , P >, ApplicationEventPublisherAware , ApplicationContextAware , InitializingBean {
88
89
89
- private static final boolean IN_NATIVE_IMAGE = System .getProperty ("org.graalvm.nativeimage.imagecode" ) != null ;
90
-
91
90
private final Optional <E > NONE = Optional .empty ();
92
91
private final Map <TypeInformation <?>, Optional <E >> persistentEntities = new HashMap <>();
93
92
private final PersistentPropertyAccessorFactory persistentPropertyAccessorFactory ;
@@ -109,7 +108,7 @@ protected AbstractMappingContext() {
109
108
this .persistentPropertyPathFactory = new PersistentPropertyPathFactory <>(this );
110
109
111
110
EntityInstantiators instantiators = new EntityInstantiators ();
112
- PersistentPropertyAccessorFactory accessorFactory = IN_NATIVE_IMAGE ? BeanWrapperPropertyAccessorFactory .INSTANCE
111
+ PersistentPropertyAccessorFactory accessorFactory = NativeDetector . inNativeImage () ? BeanWrapperPropertyAccessorFactory .INSTANCE
113
112
: new ClassGeneratingPropertyAccessorFactory ();
114
113
115
114
this .persistentPropertyAccessorFactory = new InstantiationAwarePropertyAccessorFactory (accessorFactory ,
0 commit comments