Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Spring Data

You're reading from  Spring Data

Product type Book
Published in Nov 2012
Publisher Packt
ISBN-13 9781849519045
Pages 160 pages
Edition 1st Edition
Languages
Author (1):
Petri Kainulainen Petri Kainulainen
Profile icon Petri Kainulainen
Toc

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.

The source code of our application context configuration skeleton class is given as follows...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime}