Package org.springframework.core

# Class NativeDetector

java.lang.Object
org.springframework.core.NativeDetector

public abstract class NativeDetector extends Object
A common delegate for detecting a GraalVM native image environment.

Since:
  5.3.4
Author:
  Sebastien Deleuze

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`NativeDetector.Context`
Native image context as defined in GraalVM's ImageInfo.

## Constructor Summary

Constructors
Constructor
Description
`NativeDetector()`

## Method Summary

Modifier and Type
Method
Description
`static boolean`
`inNativeImage()`
Returns `true` if running in a native image context (for example `buildtime`, `runtime`, or `agent`) expressed by setting the `org.graalvm.nativeimage.imagecode` system property to any value.
`static boolean`
`inNativeImage(NativeDetector.Context... contexts)`
Returns `true` if running in any of the specified native image context(s).

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### NativeDetector

public NativeDetector()

## Method Details

### inNativeImage

public static boolean inNativeImage()
Returns `true` if running in a native image context (for example `buildtime`, `runtime`, or `agent`) expressed by setting the `org.graalvm.nativeimage.imagecode` system property to any value.

### inNativeImage

public static boolean inNativeImage(NativeDetector.Context... contexts)
Returns `true` if running in any of the specified native image context(s).

Parameters:
  `contexts` - the native image context(s)
Since:
  6.0.10