Singleton
This is the singleton to be class:class PersistenceLibraryRepository @Inject() (private val persistenceProvider: PersistenceProvider) extends LibraryRepository { // ... }Nothing special here!
As far as I know, you cannot use the @Singleton annotation, so this is how you make this class a singleton:
class AudioliciousMigrationModule extends AbstractModule { @Override protected def configure() { bind(classOf[LibraryRepository]) .to(classOf[PersistenceLibraryRepository]) .in(Scopes.SINGLETON) } }Voila!
In Part 4 I will show you how to connect to a MySQL database using JPA 2 implemented by EclipseLink.
No comments:
Post a Comment