[Building Sakai] wiring up potentially null services

Aaron Zeckoski aaronz at vt.edu
Wed Nov 4 10:04:23 PST 2009


Yeah, I think you want to look at this code:
https://source.sakaiproject.org/svn/entitybroker/trunk/utils/src/java/org/sakaiproject/entitybroker/util/spring/BeanCollectorAutoRegistrar.java

You can use the same technique or actually use it directly if you like.
Hope that helps!
:-)
-AZ


On Wed, Nov 4, 2009 at 6:01 PM, John Bush <john.bush at rsmart.com> wrote:
> I'm working on a project where we have an optional service, similiar to say
> the ContentReviewService.  You can't directly inject in spring because the
> bean might not exist.  I've typically solved this by making a call directly
> to the component manager in the code that requires the service, and then
> testing for null everywhere.  I've been told there might be something in
> EntityBroker or somewhere else that can handle this more elegantly.   Ring a
> bell for anyone ?
>
> John Bush
> Development Manager
> rSmart
>
>
>
>
>



-- 
Aaron Zeckoski (azeckoski (at) vt.edu)
Senior Research Engineer - CARET - University of Cambridge
https://twitter.com/azeckoski - http://www.linkedin.com/in/azeckoski
http://aaronz-sakai.blogspot.com/ - http://tinyurl.com/azprofile


More information about the sakai-dev mailing list