Remove invalid configuration in RequestMappingViewResolutionIntegrationTests

Prior to this commit, RequestMappingViewResolutionIntegrationTests
invoked the following:

configurer.setTemplateLoaderPath(
	"classpath*:org/springframework/web/reactive/view/freemarker/");

However, that configuration is invalid since `classpath*:` is not
supported for a `templateLoaderPath`.

Despite that, the tests still passed since FreeMarkerConfigurer already
registers a new ClassTemplateLoader(FreeMarkerConfigurer.class, ""),
which automatically finds template files in the same package as
FreeMarkerConfigurer (for the "spring.ftl" macro library support) and
coincidentally RequestMappingViewResolutionIntegrationTests as well
(which resides in the same package).

This commit therefore removes the invalid configuration and adds a
comment to explain what's going on.
This commit is contained in:
Sam Brannen 2024-06-24 16:32:14 +02:00
parent 4e2fb308f6
commit 5d6e143ff4
1 changed files with 5 additions and 4 deletions

View File

@ -111,10 +111,11 @@ class RequestMappingViewResolutionIntegrationTests extends AbstractRequestMappin
@Bean
public FreeMarkerConfigurer freeMarkerConfig() {
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
configurer.setPreferFileSystemAccess(false);
configurer.setTemplateLoaderPath("classpath*:org/springframework/web/reactive/view/freemarker/");
return configurer;
// No need to configure a custom template loader path via setTemplateLoaderPath(),
// since FreeMarkerConfigurer already registers a
// new ClassTemplateLoader(FreeMarkerConfigurer.class, ""), which automatically
// finds template files in the same package as this test class.
return new FreeMarkerConfigurer();
}
}