Hi Steven,
I'm pretty sure *this* one won't turn out to already be in there!
Actually ... it isn't! ;-)
http://rifers.org/wiki/display/RIFE/IoC+support+for+non-element
+objects
"Spring lite" for projects that just need dependency injection of
non-element beans (injecting Datasource objects into DAOs, DAOs
into service objects, service objects into elements, etc.) but not
any of Spring's more advanced capabilities. I am using Spring on
one of my projects but on my other one it seemed too heavyweight so
I wrote this instead.
It is nowhere near as flexible or powerful as Spring but it starts
up way faster -- Spring takes a good 5 seconds to start up on my
laptop but this finishes in a few milliseconds. Those 5-second
pauses add up when you're restarting the server a lot!
I think that this is a good start and would definitely want to add
the participant to RIFE itself.
Got some remarks though:
* currently it only makes it possible to support singletons
One way of easily adding support for deferred instantiation is by
adding support for PropertyValue objects. You could then add one that
creates now instances every time the value is obtained.
* relies on properties files
It would be nice if people could set this up by simply extending your
DependencyParticipant and adding the mappings with regular Java
calls. The properties file support would then be a wrapper that uses
this.
Now, what would be super fantastically awesomely cool would be if
this dependency injection capability was built into RIFE. This
would be very cool because, since RIFE manages the lifecycle of
these objects and knows that they are singleton instances, they
could then be reloaded on the fly by RIFE's spiffy classloader.
That would cut way, way down on container restarts.
So you mean, whenever the classloader decides that thing need to be
reloaded because some of the element or site assets have changed, it
should rebuilt the properties that your participant creates? This
shouldn't be difficult to add using SiteListeners. I just don't want
to tie this into RIFE as a hard-wired feature that requires the
presence of the participant. So it need to auto-detect / auto-adapt.
What do you think?
Geert
--
Geert Bevin
Uwyn "Use what you need" - http://uwyn.com
RIFE Java application framework - http://rifers.org
Music and words - http://gbevin.com
_______________________________________________
Rife-users mailing list
[email protected]
http://lists.uwyn.com/mailman/listinfo/rife-users