Using multiple singleton beans
Multiple singletons can be useful when it becomes necessary or desirable to represent multiple objects in an application that need to be shared across the application. In this recipe, we will expand upon the previous recipe's
SingletonExample application by adding a
The second singleton is called
GameBean and maintains the state of the game. It is assumed that player information maintained in the
PlayerBean and this EJB, and its supporting files, need to be created before the
GameBean is created. The
GameBean will use the player files or initialized database to support the game.
Adding multiple singleton session beans to an application generally requires:
- Adding multiple beans annotated with the ...