Installing Spring Mobile

In this recipe, you'll learn how to install Spring Mobile and prepare the Spring configuration class for the other recipes.

How to do it…

Here are the steps to install Spring Mobile:

  1. Add the Maven dependency for Spring Mobile in pom.xml:
    <dependency>
      <groupId>org.springframework.mobile</groupId>
      <artifactId>spring-mobile-device</artifactId>
      <version>1.1.3.RELEASE</version>
    </dependency>
  2. Make the Spring configuration class extend WebMvcConfigurerAdapter:
    @Configuration
    @EnableWebMvc
    @ComponentScan(basePackages = {"com.spring_cookbook.controllers"})
    public class AppConfig extends WebMvcConfigurerAdapter {
  3. Override the addInterceptors() method from WebMvcConfigurerAdapter:
    @Override public void addInterceptors(InterceptorRegistry ...

Get Spring Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.