Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
IMPLEMENTING THE SINGLETON DESIGN PATTERN WITH @SINGLETON
To implement the Singleton Design Pattern in Java, you have to write boilerplate code like the one shown in the red box below. If you would rather not do that every time, you can just add the @Singleton class annotation to your class declaration. This is shown in the green box below. Consult the Javadoc to find out more about the @Singleton annotation, and of other GoF design patterns supported by dp4j.