Getting Started¶
Requirements:
Instancio is packaged as a multi-release JAR and can be used with Java 8 or higher.
It has a single compile
dependency on org.slf4j:slf4j-api
.
Since version 1.5.0
Instancio supports creating:
java.lang.Record
classes on Java 16sealed
classes on Java 17
Dependencies¶
There are three dependencies available from Maven central:
Dependency | Module Name | Description |
---|---|---|
instancio-core |
org.instancio.core |
Core library |
instancio-junit |
org.instancio.junit |
JUnit Jupiter integration |
instancio-processor |
org.instancio.processor |
Annotation processor for generating metamodels |
The org.instanio:instancio
artifact on Maven central is an older dependency that should no longer be used.
instancio-junit
¶
If you have JUnit 5 on the classpath, then use instancio-junit
.
It includes a transitive dependency on instancio-core
, therefore it is not necessary to import both.
instancio-core
¶
If you use JUnit 4, TestNG, or would like to use Instancio standalone, then use instancio-core
:
instancio-processor
¶
The annotation processor generates metamodels, which can be used to avoid referencing fields by their names. The annotation processor can be enabled as shown below. Please refer to the Metamodel section of the user guide for examples.