This is one of the Holon Platform example projects.
This example shows how to setup a Holon Platform Context
scope using Spring application context to provide context resource instances as Spring beans. This way, any valid Spring bean can be obtained as a context resource using the Holon Platform standard Context
API, for example through the static Context.get().resource(Class<T> resourceType)
method.
This example addresses the following topics:
- Use the
@EnableBeanContext
annotation to setup the Spring beans Context scope - Use the
Context
API to obtain context resources
The ExampleResource interface represents the example class to be made available as a Context
resource.
The Main class contains the code to setup the Spring context and use the Context
API to obtain the ExampleResource
context resource.
Run the Main
Java class. The following output is expected:
Message: Example resource
Message: Example resource
Message: Thread resource
The complete Holon Platform reference guide is available here.
For the specific documentation about the components used in this example see:
The Holon Platform is built using Java 8, so you need a JRE/JDK version 8 or above to build and run this example projects.
All the Holon Platform modules and examples are Open Source software released under the Apache 2.0 license.
See Holon Platform Examples for the examples directory.