ShiroWebModule allows you to override its default SessionManager
binding by overriding the "bindSessionManager" method. The setup would
look something like this:
@Override
protected void configureShiroWeb()
{
bind(SessionDAO.class).to(MySessionDao.class);
bind(SessionFactory.class).to(MySessionFactory.class);
bind(CacheManager.class).to(EhCacheManager.class);
}
@Override
protected void bindSessionManager(final
AnnotatedBindingBuilder<SessionManager> bind)
{
bind.to(DefaultWebSessionManager.class);
}
-Jared
On Thu 24 May 2012 03:15:04 PM CDT, manitas wrote:
> Hello,
>
> I'm using shiro configured via guice in my project and I need to store my
> session in a database.
>
> Unfortunately I'm blocked at the injection phase :
> bind(SessionManager.class).to(DefaultWebSessionManager.class);
>
> an error occured because some implementation classes are already injected.
>
> What I would like to achieve is the following configuration :
> ********
> sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
> securityManager.sessionManager = $sessionManager
>
> sessionDAO = com.xxx.MySessionDAO
> securityManager.sessionManager.sessionDAO = $mySessionDAO
>
> sessionFactory = com.xxx.MySessionFactory
> securityManager.sessionManager.sessionFactory = $sessionFactory
>
> cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
> securityManager.cacheManager = $cacheManager
> **********
>
> Thanks in advance for your help.
>
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Native-session-and-custom-sessionDao-with-guice-tp7575633.html
> Sent from the Shiro User mailing list archive at Nabble.com.