You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Lally Singh <la...@gmail.com> on 2007/03/21 21:02:52 UTC

Spring Contexts

Hey all,

 I was wondering how people pass around the Spring context through
their app.  Every time something needs to access a bean, it seems
pretty ridiculous to pass around a Context parameter through each
method.

 Is there a single static context object I can just store as a static
var in a utility class?  Any per-request ones?

 If anyone knows a _short_ book on getting up to speed on using
Spring, I'd appreciate it.  The tomes I've got on Cocoon & Hibernate
are already pretty heavy, and I've given up looking for any useful
docs outside of the Maven 2 online book.

  Thanks in advance,

  -A developer overwhelmed with technologies.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org


Re: Spring Contexts

Posted by David Legg <da...@searchevent.co.uk>.

Lally Singh wrote:
> If anyone knows a _short_ book on getting up to speed on using
> Spring, I'd appreciate it.  The tomes I've got on Cocoon & Hibernate
> are already pretty heavy.


My favourite is "Spring A developer's Notebook" by Tate & Gehtland 
published by O'Reilly: ISBN 0-596-00910-0 in a Purple cover.

O'Reilly also do a "Hibernate A Developer's Notebook" in the same series 
which I found very readable too.


I might get shot for this... but I'd be tempted to use the 'Singleton' 
pattern to manage the Spring context.  I think the 'proper' way to do it 
is to create your own Cocoon component which implements ThreadSafe and 
Contextualizable.  You could then create and inject the Spring context 
into this at initialization time.  It should then be available from the 
context of your application and not have to be explicitly passed around 
as a parameter.

I did this once for the HiveMind Registry so I could follow the "Bricks 
CMS" demo (http://wiki.apache.org/cocoon/BricksCms).

David Legg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@cocoon.apache.org
For additional commands, e-mail: users-help@cocoon.apache.org