From the course: Spring: Spring MVC

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Define ThemeChangeInterceptor

Define ThemeChangeInterceptor

From the course: Spring: Spring MVC

Start my 1-month free trial

Define ThemeChangeInterceptor

- Now in our application, we are going to use the CookieThemeResolver. So let's see how to utilize that. You have to go in your ApplicationConfig. So let's grab that ApplicationConfig file, let's come down there and in this, we're going to define the theme resolver Bean. So that'll be instantiated for us and I have annotated it with Bean for that purpose. So ThemeResolver and let's write inside it the actual object, the actual implementation that we need to pick up. So I'm going to instantiate CookieThemeResolver and to this CookieThemeResolver, I will set the cookie name. What this means is, we said that the CookieThemeResolver is going to pick up the name of the theme from the cookie from your browser. So how is that cookie going to be stored? How is it going to be identified? That is the name that I'm trying to configure here. So let's say it is called just theme. And another thing that we can set on this is…

Contents