You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shiro.apache.org by "Jared Bunting (JIRA)" <ji...@apache.org> on 2012/06/06 05:58:22 UTC

[jira] [Updated] (SHIRO-370) Allow for a more type-safe way to set properties when using Guice integration

     [ https://issues.apache.org/jira/browse/SHIRO-370?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jared Bunting updated SHIRO-370:
--------------------------------

    Description: 
Currently, setting properties when using Guice integration is somewhat hacky.  We're just binding constants to strings, and hoping that the names match up with method calls.  I would prefer something more guicey, that provides us with the typesafety that I tend to expect from Guice.

My thought is to allow methods, similar to the @Provides methods, on the ShiroModule and ShiroWebModule with a @Configures annotation.  These methods would then be essentially wrapped in a MembersInjector and setup to be passed a particular object just after its instantiation.

The goal would be to allow something like this in the module:

    @Configures
    public void configureSessionManager(DefaultWebSessionManager webSessionManager, Cookie cookie)
    {
        webSessionManager.setSessionIdCookie(cookie);
        webSessionManager.setGlobalSessionTimeout(5000L);
    }

The DefaultWebSessionManager would be the bean being injected, while the Cookie would simply be treated as an injected dependency, much like the arguments in a @Provides method.  

  was:
Currently, setting properties when using Guice integration is somewhat hacky.  We're just binding constants to strings, and hoping that the names match up with method calls.  I would prefer something more guicey, that provides us with the typesafety that I tend to expect from Guice.

My thought is to allow methods, similar to the @Provides methods, on the ShiroModule and ShiroWebModule with a @Configures annotation.  These methods would then be essentially wrapped in a MembersInjector and setup to be passed a particular object just after its instantiation.

The goal would be to allow something like this in the module:

    @Configures
    public void configureSessionManager(DefaultWebSessionManager webSessionManager, Cookie cookie)
    {
        webSessionManager.setSessionIdCookie(cookie);
    }

The DefaultWebSessionManager would be the bean being injected, while the Cookie would simply be treated as an injected dependency, much like the arguments in a @Provides method.  

    
> Allow for a more type-safe way to set properties when using Guice integration
> -----------------------------------------------------------------------------
>
>                 Key: SHIRO-370
>                 URL: https://issues.apache.org/jira/browse/SHIRO-370
>             Project: Shiro
>          Issue Type: New Feature
>            Reporter: Jared Bunting
>            Assignee: Jared Bunting
>
> Currently, setting properties when using Guice integration is somewhat hacky.  We're just binding constants to strings, and hoping that the names match up with method calls.  I would prefer something more guicey, that provides us with the typesafety that I tend to expect from Guice.
> My thought is to allow methods, similar to the @Provides methods, on the ShiroModule and ShiroWebModule with a @Configures annotation.  These methods would then be essentially wrapped in a MembersInjector and setup to be passed a particular object just after its instantiation.
> The goal would be to allow something like this in the module:
>     @Configures
>     public void configureSessionManager(DefaultWebSessionManager webSessionManager, Cookie cookie)
>     {
>         webSessionManager.setSessionIdCookie(cookie);
>         webSessionManager.setGlobalSessionTimeout(5000L);
>     }
> The DefaultWebSessionManager would be the bean being injected, while the Cookie would simply be treated as an injected dependency, much like the arguments in a @Provides method.  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira