File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Caching Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Caching" Watch "Caching" New topic


amol bakre

Joined: May 21, 2001
Posts: 29

I needed to cache some values from the DB into the application as they are static values and used across the application. I am using struts2 and springs jdbc for DB access. I was wondering where should be the best place to do this, is there any facility in struts 2 or should i use springs to do this, tried to find something about spring caching, but looks should simply use an onload servlet make pure jdbc calls and cache the parameters / values, which i thought would not be the wisest choice..

Would appreciate suggestions, also where could i find something on spring caching that is simple to understand and write as the job required is pretty simple..

manoj r patil
Ranch Hand

Joined: Jun 06, 2002
Posts: 181
May be you can take a look at jboss cache which is open source server side implementation for tree based caching.

love your job and not your company;
...because you never know when your company will stop loving you!
David Newton

Joined: Sep 29, 2008
Posts: 12617

Moving to... Spring?

Struts has nothing to do with data retrieval or caching.
dileep keely
Ranch Hand

Joined: Jun 28, 2010
Posts: 108

Hope this will help!!
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

This actually isn't Spring specific either.

you can use any Caching product out there. If you wanted to preload data into the cache, then you could create a Spring bean for it and make an init method. In xml that would be <bean init-method="nameOfMethodToRun"/>

or put the

@PostConstruct annotation on the method you want to run. and include
<context:annotation-config/> in your xml

By the way the framework is the Spring Framework, there is no plural like there is in Struts.


Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
I agree. Here's the link:
subject: Caching
It's not a secret anymore!