The Environment is loaded by a servlet context listener, which is managed
by the container and consequently supports injection. Then it's just a
matter of injecting your JpaRealm, building a WebSecurityManager from it,
and associating the SecurityManager with the Environment.


On Tue, May 29, 2012 at 8:10 PM, melvyndekort - [email protected] wrote:

> Hi all,
>
> I am creating an application using CDI, JPA2 and JSF2.
> As a security framework I want to implement Apache Shiro.
> This is my first big project using these frameworks, so I don't know the
> ins
> and outs yet...
>
> I have created my own JpaRealm, with simple Entity Beans in combination
> with
> an EntityManager, I don't use any DAOs.
> I'm trying to use CDI to inject the EntityManager into my JpaRealm.
> Of course this doesn't work since my JpaRealm is not container managed but
> is instantiated by Shiro itself.
> I've tried injection by using the @PersistenceContext, @PersistenceUnit and
> @Inject with a separate Producer.
>
> After some browsing through the Shiro documentation I built my own
> WebEnvironment which extends IniWebEnvironment.
> But my EntityManager can't be injected here either, since this class is
> also
> not instantiated by the container afaik.
> Does anybody know of a way to inject my EntityManager into my JpaRealm?
>
> I can supply my code if needed...
>
> Thank you in advance!
>
> --
> View this message in context:
> http://shiro-user.582556.n2.nabble.com/Shiro-in-CDI-JPA2-JSF2-project-tp7577437.html
> Sent from the Shiro User mailing list archive at Nabble.com.
>
>

Reply via email to