@Override
    protected View loadView(
        @Nonnull
        final String viewName, @Nonnull
        final Locale locale) throws Exception {
        LOGGER.trace("Attempting to resolve view [{}] via locale [{}]", viewName, locale);
        val applicationContext = obtainApplicationContext();
        val view = applicationContext.containsBean(viewName)
            ? applicationContext.getBean(viewName, View.class)
            : delegate.resolveViewName(viewName, locale);

        if (view instanceof final AbstractThymeleafView thymeleafView) {
            configureTemplateThemeDefaultLocation(thymeleafView);

            thymeleafViewResolverConfigurers.stream()
                .sorted(OrderComparator.INSTANCE)
                .forEach(configurer -> configurer.configureThymeleafView(thymeleafView));
        }
        return view;
    }
{@link ThemeViewResolver} is a theme resolver that checks for a UI view in the specific theme before utilizing the
base UI view.

@author Daniel Frett
@since 5.2.0
support/cas-server-support-thymeleaf-core/src/main/java/org/apereo/cas/services/web/ThemeViewResolver.java