You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 9, 2019. It is now read-only.
I am able to inject the JedisPool in my controllers but not in models, daos or other classes. An example is in my UserDAO. Isn't this supported or why does the exact same code work in the Application controller?
...
importjavax.inject.Inject;
importredis.clients.jedis.Jedis;
importredis.clients.jedis.JedisPool;
publicclassUserDAOextendsAbstractDAO<User, User_> {
@InjectJedisPooljedisPool;
publicUserDAO() {
super(User.class, User_.class);
}
/** * @return an instance of {@link UserDAO}. */publicstaticUserDAOnewInstance() {
returnnewUserDAO();
}
...
// -- Redis/** * Get the last time the user accessed the service. * * @param user the {@link models.User} * @return the last time as a {@link org.joda.time.DateTime} */publicDateTimegetLastAccess(Useruser) {
if(jedisPool == null) {
Logger.error("Redis is not available");
returnnull;
}
Jedisj = jedisPool.getResource();
DateTimedateTime = null;
try {
StringdtString = j.hget("userLastAccess", user.id.toString());
dateTime = newDateTime(Long.valueOf(dtString));
} catch(NumberFormatExceptionex) {
dateTime = null;
} finally {
jedisPool.returnResource(j);
}
returndateTime;
}
}