Additional theme removal updates

See gh-33809
This commit is contained in:
rstoyanchev
2025-01-15 17:17:26 +00:00
parent 9cfece0d54
commit b8c51a2767
21 changed files with 20 additions and 133 deletions

View File

@@ -14,14 +14,13 @@
* limitations under the License.
*/
@file:Suppress("DEPRECATION")
package org.springframework.docs.web.webmvc.mvcconfig.mvcconfiginterceptors
import org.springframework.context.annotation.Configuration
import org.springframework.web.servlet.config.annotation.InterceptorRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
import org.springframework.web.servlet.handler.UserRoleAuthorizationInterceptor
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor
import org.springframework.web.servlet.theme.ThemeChangeInterceptor
// tag::snippet[]
@Configuration
@@ -29,7 +28,7 @@ class WebConfiguration : WebMvcConfigurer {
override fun addInterceptors(registry: InterceptorRegistry) {
registry.addInterceptor(LocaleChangeInterceptor())
registry.addInterceptor(ThemeChangeInterceptor()).addPathPatterns("/**").excludePathPatterns("/admin/**")
registry.addInterceptor(UserRoleAuthorizationInterceptor()).addPathPatterns("/**").excludePathPatterns("/admin/**")
}
}
// end::snippet[]

View File

@@ -14,7 +14,9 @@
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/admin/**"/>
<bean class="org.springframework.web.servlet.theme.ThemeChangeInterceptor"/>
<bean class="org.springframework.web.servlet.handler.UserRoleAuthorizationInterceptor">
<property name="authorizedRoles" value="ROLE_USER"/>
</bean>
</mvc:interceptor>
</mvc:interceptors>
<!-- end::snippet[] -->