The cache configuration

To enable the use of annotation-based configuration, first of all, the Spring Framework has to be registered using the cache namespace. The following configuration can be used to declare the namespace for cache and register the annotation:

<beans xmlns="http://www.springframework.org/schema/beans" 
  xmlns:cache="http://www.springframework.org/schema/cache" 
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
  xsi:schemaLocation="http://www.springframework.org/schema/beans 
    http://www.springframework.org/schema/beans/spring-beans.xsd  
    http://www.springframework.org/schema/cache 
    http://www.springframework.org/schema/cache/spring-cache.xsd"> 
  <cache:annotation-driven/> 
</beans> 

Once the registration is done, it's time to ...

Get Learning Spring 5.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.