Skip to content

Kernel configuration

Pierre T. edited this page Oct 14, 2015 · 1 revision

Create a kernel using the NuunCore class. It accepts a KernelConfiguration, a builder for initializing the kernel.

KernelConfiguration configuration = NuunCore.newKernelConfiguration()
    .params("key1", "val1", "key2", "val2")
    .addPlugin(MyAdditionalPlugin.class);

NuunCore.createKernel(configuration);
Table 1. Kernel configurations
Method Description

params(String…​ paramEntries)

Specifies kernel parameters. The most important is certainly the Kernel.NUUN_ROOT_PACKAGE which specifies the root package to scan.

containerContext(Object containerContext)

Sets the container context which will be passed to plugins.

plugins(Plugin…​ plugins)

Specifies the plugins to be used by the Nuun kernel.

withoutSpiPluginsLoader()

Disables the plugin scan via the service loader. This allows to only use the plugins explicitly specified in the kernel configuration.

withSpiPluginsLoader()

Enables the plugin scan via the service loader. All the plugins declared in META-INF/services will be used by the Nuun kernel.

dependencyInjectionMode(DependencyInjectionMode mode)

Sets the dependency injection mode. Kernel modes are the mode in which the internal dependency injection framework should work: production mode, dev mode, tools mode. They were inspired by Guice Stage.

classpathScanMode(ClasspathScanMode mode)

Sets the classpath scan mode. - NOMINAL: This mode is the nominal behaviour where the scanner will reach information from the filesystem. - IN_MEMORY: This mode tells the kernel to read its class and resources information from the memory. This mode will be use mainly for unit test.

moduleValidation(ModuleValidation validation)

Sets a ModuleValidation which will be used to assert UnitModule given by the plugins.

Content

Clone this wiki locally