I'm currently experimenting with another approach for integrating CDI injection and shiro.ini.

The idea is to make @Named CDI beans available to the Shiro environment using a custom CdiIniWebEnvironment so that a $foo reference will resolve to a managed bean named "foo" - that way, bean instances will be created by the CDI BeanManager and not by Shiro, so @Inject will work as expected.

I'll create a feature request and attach a patch, once my code is cleaned up a bit.

Best regards,
Harald

Am 09.03.2013 20:59, schrieb Les Hazlewood:
On Sat, Mar 9, 2013 at 1:38 AM, Mo Maison <[email protected]
<mailto:[email protected]>> wrote:


    @Harald & @Les : thank you for your answers.

    I managed to work around JEE objects injection, by adding
    some utility static factory code in order to get arbitrary class
    objects in .ini ; not always an applicable solution though.

    I noticed two strange things with INI however :

    1 - it is not possible to dereference properties of referenced objects
       at the right of the = sign.
       obj.prop = $ref works, but obj = $ref.prop does not.
       I was very disappointed by this limitation.


I'm surprised I haven't thought of this! Please open a Jira feature
enhancement - this wouldn't be hard to support.

    2 - when injecting a property whose setter expects say a Set,
       special handling is performed (split string with comma and build
       a set before injection or so...).
       But this is performed /also/ for references, thus this does not work
       if myUrlsSetRef is already a Set :
       obj.urlsSet = $myUrlsSetRef
       because shiro wraps the referenced set into a new set with 1 element.
       I had to create a fake setter with Object attribute type to avoid
    this.
       I'd suggest to disable this wrapping mechanism for references
       (but it may break compatibility).


Please open a bug for this, it should be fixed asap.

Please keep the feedback coming along with any help w/ CDI - it is much
appreciated.

Best,

Les

Reply via email to