shiro-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "picpoc (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (SHIRO-359) Realm not initialised when bound in servlet mode with guice
Date Tue, 14 May 2013 01:51:16 GMT

    [ https://issues.apache.org/jira/browse/SHIRO-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13656626#comment-13656626
] 

picpoc edited comment on SHIRO-359 at 5/14/13 1:49 AM:
-------------------------------------------------------

Late comment: it's not really a bug, just a subtlety of Guice.
Instead of binding realms like:

    bindRealm().to(SampleRealm .class).in(Singleton.class);

bind it like that:

    bind(SampleRealm.class);
    bindRealm().to(SampleRealm.class).in(Singleton.class);

and the init method is called.

"Behind the curtain" explanation can be found in the description of [SHIRO-369].
                
      was (Author: picpoc):
    Late comment: it's not really a bug, just a subtlety of Guice.
Instead of binding realms like:

    bindRealm().to(SampleRealm .class).in(Singleton.class);

bind it like that:

    bind(SampleRealm.class);
    bindRealm().to(SampleRealm.class).in(Singleton.class);

and the init method is called.
                  
> Realm not initialised when bound in servlet mode with guice
> -----------------------------------------------------------
>
>                 Key: SHIRO-359
>                 URL: https://issues.apache.org/jira/browse/SHIRO-359
>             Project: Shiro
>          Issue Type: Bug
>          Components: Realms 
>    Affects Versions: 1.2.0
>            Reporter: HG
>            Assignee: Jared Bunting
>              Labels: OnInit
>         Attachments: OxAuthenticatingRealm.java, ShiroConfigurationModule.java
>
>
> I have a SampleRealm class which extends TextConfigurationRealm. 
> I bind it in configureShiroWeb() method of ShiroWebModule with   bindRealm().to(SampleRealm
.class).in(Singleton.class);
> My expectation is OnInit() to be called at some point.
> But that never happens. 
> I guess that should happen through  InitializableInjectionListener() with Guice, but
doesn't get triggered.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message