I'm using @NamedCache
annotation without any problem in dev mode by using activator run. I've specified caches other than default cache called play in application.conf file as play.cache.bindCaches = ["user-cache", "session-cache"]
. This works fine without any problem as I've checked getting named cache by using CacheManager.
However, in production mode. I'm using activator dist
command. Then, unzip created created snapshot found in target\universal\project-name address.After that I'm using
java -Dhttp.port=9000 -Dconfig.resource=application.conf -cp "../lib/*;../conf" play.core.server.ProdServerStart
command to start application in production mode.
When I use @NamedCache
annotation in production it gives error:
1) No implementation for play.cache.CacheApi annotated with @play.cache.NamedCache(value=session-cache) was bound.
while locating play.cache.CacheApi annotated with @play.cache.NamedCache(value=session-cache)
for field at services.space.SessionSpace.cache(SessionSpace.java:19)
while locating services.space.SessionSpace
for field at services.SecurityService.sessionSpace(SecurityService.java:21)
while locating services.SecurityService
for field at common.Response.securityService(Response.java:17)
while locating common.Response
for field at controllers.BaseController.response(BaseController.java:53)
while locating controllers.Application
for parameter 2 at router.Routes.<init>(Routes.scala:60)
while locating router.Routes
while locating play.api.inject.RoutesProvider
while locating play.api.routing.Router
After getting this error, I've removed NamedCache's and used default cache. When I do that, everything works fine. Again, in dev mode NamedCache works as expected.