Class Springleton

All Implemented Interfaces:
Aware, ApplicationContextAware

public class Springleton extends ApplicationObjectSupport
Global singleton that provides access to the application context in which it is defined from anywhere. Reminiscent of Spring's "evil singleton" from days of yore.

This bean allows at most one instantiated instance per class loader, and that instance may be defined in at most one ApplicationContext. In particular, this means web containers hosting multiple web applications must create separate class loaders per web application.

This class may be subclassed to add autowired properties, etc. If so, access the singleton in the same way (i.e., via Springleton.getInstance()) and then downcast as needed.