Skip to content

Commit 5d6e143

Browse files
committed
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.
1 parent 4e2fb30 commit 5d6e143

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spring-webflux/src/test/java/org/springframework/web/reactive/result/method/annotation/RequestMappingViewResolutionIntegrationTests.java

+5-4
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,11 @@ public void configureViewResolvers(ViewResolverRegistry registry) {
111111

112112
@Bean
113113
public FreeMarkerConfigurer freeMarkerConfig() {
114-
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
115-
configurer.setPreferFileSystemAccess(false);
116-
configurer.setTemplateLoaderPath("classpath*:org/springframework/web/reactive/view/freemarker/");
117-
return configurer;
114+
// No need to configure a custom template loader path via setTemplateLoaderPath(),
115+
// since FreeMarkerConfigurer already registers a
116+
// new ClassTemplateLoader(FreeMarkerConfigurer.class, ""), which automatically
117+
// finds template files in the same package as this test class.
118+
return new FreeMarkerConfigurer();
118119
}
119120
}
120121

0 commit comments

Comments
 (0)