Starting up Nuts in Java is simple.
You need to make sure the following jar files are in the classpath:
Then, call the jfun.yan.xml.NutsProcessor class to start up:
The above code assumes that the top level application object is named "application". Of course, the naming convention is all up to you.
By instantiating this object, the entire object graph should have been initialized and wired up properly.
Instantiate eagerly initialized components
Nuts support eager-initialization via the "eager-init" attribute. Any global components marked as eager-init="true" is going to be eagerly instantiated even when it is not exported by the module.
The NutsProcessor.preInstantiate() method is responsible for instantiating these eager components.
The simplest form to instantiate eager components is:
This method has other overloaded versions to allow instantiation with dependencies resolved in an alternative container. For example, we may use a container hierarchy to resolve dependencies: