user and userRole beans in the app context

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

user and userRole beans in the app context

Roshan Dawrani
Hi

I am having a small issue related to "user" / "userRole" beans created in the application context of a grails app that uses spring security.

Can someone please point me to where these beans are introduced in the app context?

--
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani
Skype: roshandawrani

Reply | Threaded
Open this post in threaded view
|

Re: user and userRole beans in the app context

burtbeckwith
They're from the domain classes created by the s2-quickstart script. All domain classes have associated Spring beans.

Burt

> Hi
>
> I am having a small issue related to "user" / "userRole" beans created in
> the application context of a grails app that uses spring security.
>
> Can someone please point me to where these beans are introduced in the app
> context?
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: user and userRole beans in the app context

Roshan Dawrani
Actually in my case userDomainClassName, authorityJoinClassName, etc point to custom versions of User/Role/UserRole classes and these are not domain classes anymore.

I wanted to see exactly how and where Spring Security plugin creates an instance of these  classes. Where can I find that point?

On Thu, Jan 20, 2011 at 10:29 PM, Burt Beckwith <[hidden email]> wrote:
They're from the domain classes created by the s2-quickstart script. All domain classes have associated Spring beans.

Burt

> Hi
>
> I am having a small issue related to "user" / "userRole" beans created in
> the application context of a grails app that uses spring security.
>
> Can someone please point me to where these beans are introduced in the app
> context?
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani
Skype: roshandawrani

Reply | Threaded
Open this post in threaded view
|

Re: user and userRole beans in the app context

burtbeckwith
org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService

Burt

> Actually in my case userDomainClassName, authorityJoinClassName, etc point
> to custom versions of User/Role/UserRole classes and these are not domain
> classes anymore.
>
> I wanted to see exactly how and where Spring Security plugin creates an
> instance of these  classes. Where can I find that point?
>
> On Thu, Jan 20, 2011 at 10:29 PM, Burt Beckwith <[hidden email]>wrote:
>
> > They're from the domain classes created by the s2-quickstart script. All
> > domain classes have associated Spring beans.
> >
> > Burt
> >
> > > Hi
> > >
> > > I am having a small issue related to "user" / "userRole" beans created in
> > > the application context of a grails app that uses spring security.
> > >
> > > Can someone please point me to where these beans are introduced in the
> > app
> > > context?
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: user and userRole beans in the app context

Roshan Dawrani
No, tracing org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService didn't help me. This seems to be getting invoked when a user logs in, which is fine, but even before that, from somewhere else, an empty instance of my User class is put in the app context as the "user" bean, and that's causing me issues.

So, if I just start the server and stop it (no logins involved), when app context is destroyed, there is this empty "user" instance, whose destruction is causing me an issue.

Any more pointers please?


On Thu, Jan 20, 2011 at 10:55 PM, Burt Beckwith <[hidden email]> wrote:
org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService

Burt

> Actually in my case userDomainClassName, authorityJoinClassName, etc point
> to custom versions of User/Role/UserRole classes and these are not domain
> classes anymore.
>
> I wanted to see exactly how and where Spring Security plugin creates an
> instance of these  classes. Where can I find that point?
>
> On Thu, Jan 20, 2011 at 10:29 PM, Burt Beckwith <[hidden email]>wrote:
>
> > They're from the domain classes created by the s2-quickstart script. All
> > domain classes have associated Spring beans.
> >
> > Burt
> >
> > > Hi
> > >
> > > I am having a small issue related to "user" / "userRole" beans created in
> > > the application context of a grails app that uses spring security.
> > >
> > > Can someone please point me to where these beans are introduced in the
> > app
> > > context?
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list, please visit:
> >
> >    http://xircles.codehaus.org/manage_email
> >
> >
> >
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

   http://xircles.codehaus.org/manage_email





--
Roshan
Blog: http://roshandawrani.wordpress.com/
Twitter: @roshandawrani
Skype: roshandawrani

Reply | Threaded
Open this post in threaded view
|

Re: user and userRole beans in the app context

burtbeckwith
There aren't any other uses in the plugin, but Grails creates one or two instances of most artifacts during startup to inspect properties when building mappings, etc. Are you doing something in the constructor that would be better in beforeInsert or beforeUpdate?

Burt

> No, tracing
> org.codehaus.groovy.grails.plugins.springsecurity.GormUserDetailsService
> didn't help me. This seems to be getting invoked when a user logs in, which
> is fine, but even before that, from somewhere else, an empty instance of my
> User class is put in the app context as the "user" bean, and that's causing
> me issues.
>
> So, if I just start the server and stop it (no logins involved), when app
> context is destroyed, there is this empty "user" instance, whose destruction
> is causing me an issue.
>
> Any more pointers please?

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: user and userRole beans in the app context

Roshan Dawrani
On Fri, Jan 21, 2011 at 1:08 AM, Burt Beckwith <[hidden email]> wrote:
There aren't any other uses in the plugin, but Grails creates one or two instances of most artifacts during startup to inspect properties when building mappings, etc. Are you doing something in the constructor that would be better in beforeInsert or beforeUpdate?


No, I my User class is with default constructor. The problem is coming from the hashCode() method, which uses some field values for equality.

Since Grails puts an empty instance in the context, it gets destroyed when the app context is being closed, and this uninitialized instance (fields being used for hashCode calculation) cause NPE when hashCode() gets called by Spring for removing it from its internal bean map.