Databases Reference
In-Depth Information
The official Redis homepage has a comprehensive documentation that
offers more information about the usage and configuration of Redis. This
documentation is available at http://redis.io/documentation .
Getting the required dependencies
Getting the dependencies required by Spring Data Redis is rather easy. The only
dependency that is required is Spring Data Redis, and we can get it by adding the
following dependency declaration to the pom.xml file:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-redis</artifactId>
<version>1.0.1.RELEASE</version>
</dependency>
Configuring the Spring application
context
We will use the Java configuration for configuring the application context of
our application. The name of our application context configuration class is
ApplicationContext , and its implementation is explained in the following points:
1. The @Configuration annotation is used to identify the class as an
application context configuration class.
2. The @ComponentScan annotation is used to configure the base package
of our controllers.
3. The @EnableWebMvc annotation is used to enable the Spring MVC.
4. The values of the configuration parameters are fetched from a property
file that is imported by using the @PropertySource annotation. The
Environment interface is used to access the property values stored in this file.
5.
The redisConnectionFactory() method is used to configure the Redis
connection factory bean. The implementation of this method depends on the
used Redis connector.
 
Search WWH ::




Custom Search