Note that if you are running in a clustered environment (or want to
be ready to move to one without rewriting your application) this is
not a good solution. The ServletContext is specifically not to be
shared amongst clustered interests according to the specifications.
This is particularly a problem if the data will ever be modified in
the application; if you really are reading it from the database but
only changing the database between application restarts, you could
probably get away with it.
Hibernate offers a flexible second-level cache which can provide the
kind of insulation against repeated trips to the database. (see
http://www.hibernate.org/hib_docs/v3/reference/en/html_single/#performance-cache)
If you really aren't using the database to update your menu, i'd
suggest just making it a Spring bean and populating it in XML; if you
implement the ServletContextAware and InitializingBean interfaces,
you can even have your bean put itself into the ServletContext at
initialization time.
Joe
At 12:12 AM -0500 9/30/05, Nick Heudecker wrote:
You have a few options. To initialize Spring, you can either use the Struts
plugin or the web app context listener. Once that's done you can either use
a startup servlet or a Struts plugin to load the data and put it into the
servlet context. That way it only needs to be loaded once and is shared
throughout the application.
It's pretty simple, but not very obvious.
On 9/30/05, Martin Ravell <[EMAIL PROTECTED]> wrote:
I have Menu information for my app in the database which I would like to
be
able to load somehow when my app server starts up (or app is deployed).
This
would be much more efficient than the current method of having each user
load it when they enter the application.
Can anyone suggest how to best go about doing this? The architecture is
Struts, Hibernate and Spring.
Thanks
Marty
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Joe Germuska
[EMAIL PROTECTED]
http://blog.germuska.com
"Narrow minds are weapons made for mass destruction" -The Ex
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]