I want to load the data from database into cache memory using Spring ehCache when the application starts i.e when the server starts before any other method is called. I dont
This is exactly what the BootstrapCacheLoader
will do for you.
Have a look at the following documentation entry.
It seems this is fully integrated in the Spring Ehcache bridge - see here
In short the steps to get there are:
BootstrapCacheLoader
that will use the set to load eagerly all entries, async or sync at cache initialisation time.BootstrapCacheLoaderFactory
through XML (Ehcache) or even directly (Spring)