Implemented a simple UserIdSource, that stores the user in a cookie
[examples/facebook-app] / src / main / java / de / juplo / yourshouter / WebMvcConfig.java
1 package de.juplo.yourshouter;
2
3
4
5 import javax.inject.Inject;
6
7 import org.springframework.context.annotation.Configuration;
8 import org.springframework.social.connect.UsersConnectionRepository;
9 import org.springframework.web.servlet.config.annotation.EnableWebMvc;
10 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
11 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
12
13
14 /**
15  * Spring MVC Configuration.
16  *
17  * @author Kai Moritz
18  */
19 @Configuration
20 @EnableWebMvc
21 public class WebMvcConfig extends WebMvcConfigurerAdapter
22 {
23   @Inject
24   private UsersConnectionRepository usersConnectionRepository;
25
26
27   /**
28    * Configure the {@link UserCookieInterceptor} to intercept all requests.
29    *
30    * @param registry
31    *     The {@link InterceptorRegistry} to use.
32    *
33    * @see {@link UserCookieInterceptor}
34    */
35   @Override
36   public void addInterceptors(InterceptorRegistry registry)
37   {
38     registry.addInterceptor(new UserCookieInterceptor(usersConnectionRepository));
39   }
40 }