@Bean
    @ConditionalOnMissingBean(name = "themesStaticResourcesWebMvcConfigurer")
    public WebMvcConfigurer themesStaticResourcesWebMvcConfigurer(
        final CasConfigurationProperties casProperties,
        final WebProperties webProperties,
        final ThymeleafProperties thymeleafProperties) {
        return new WebMvcConfigurer() {
            @Override
            public void addResourceHandlers(
                @Nonnull
                final ResourceHandlerRegistry registry) {
                val templatePrefixes = casProperties.getView().getTemplatePrefixes();
                if (!templatePrefixes.isEmpty()) {
                    val registration = registry.addResourceHandler("/**");

                    val locations = templatePrefixes
                        .stream()
                        .map(prefix -> StringUtils.appendIfMissing(prefix, "/"))
                        .toArray(String[]::new);
                    registration.addResourceLocations(locations);
                    registration.addResourceLocations(webProperties.getResources().getStaticLocations());

                    FunctionUtils.doIfNotNull(webProperties.getResources().getCache().getPeriod(), period -> registration.setCachePeriod((int) period.toSeconds()));
                    registration.setCacheControl(webProperties.getResources().getCache().getCachecontrol().toHttpCacheControl());
                    registration.setUseLastModified(true);
                    val cache = thymeleafProperties != null && thymeleafProperties.isCache();
                    val chainRegistration = registration.resourceChain(cache);
                    val resolver = new PathResourceResolver();

                    val resources = templatePrefixes
                        .stream()
                        .map(prefix -> StringUtils.appendIfMissing(prefix, "/"))
                        .map(Unchecked.function(ResourceUtils::getRawResourceFrom))
                        .toArray(Resource[]::new);
                    LOGGER.debug("Adding resource handler for resources [{}]", (Object[]) resources);
                    resolver.setAllowedLocations(resources);
                    
                    val chainProperties = webProperties.getResources().getChain();
                    if (BooleanUtils.isTrue(chainProperties.getEnabled())) {
                        val paths = chainProperties.getStrategy().getContent().getPaths();
                        val versionResourceResolver = new VersionResourceResolver();
                        versionResourceResolver.addVersionStrategy(new ContentVersionStrategy(), paths);
                        chainRegistration.addResolver(versionResourceResolver);
                    }
                    chainRegistration.addResolver(resolver);
                }
            }
        };
    }
This is {@link CasThemesAutoConfiguration}.

@author Misagh Moayyed
@since 5.0.0
support/cas-server-support-themes/src/main/java/org/apereo/cas/config/CasThemesAutoConfiguration.java