A couple of days ago i implemented Caching feature in Spring framework in a project and that was interesting but now this question has been brought to my mind that what is difference of using Spring Cache and fetching or initializing data on application startup and keeping that in a variable whitin a spring bean which can be accessed via a getter?
If you have a single application instance, you don't care about any of more complex features (listed below) and you synchronize access to the variable correctly for multi-threaded use, there's no difference. Cache is cache - you have temporarily stored a value that is otherwise expensive to calculate or fetch.
However, Spring Cache provides generic interface to specialized caching subsystems (for example EhCache, Redis....). In EhCache you can configure things like: