|
|
|
@ -42,6 +42,7 @@ import org.springframework.core.Ordered;
|
|
|
|
|
import org.springframework.core.annotation.Order;
|
|
|
|
|
import org.springframework.core.convert.converter.Converter;
|
|
|
|
|
import org.springframework.core.convert.converter.GenericConverter;
|
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
import org.springframework.core.io.ClassPathResource;
|
|
|
|
|
import org.springframework.core.io.Resource;
|
|
|
|
|
import org.springframework.core.io.ResourceLoader;
|
|
|
|
@ -103,12 +104,24 @@ public class WebMvcAutoConfiguration {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static String DEFAULT_PREFIX = "";
|
|
|
|
|
public static String DEFAULT_SUFFIX = "";
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
|
@ConditionalOnMissingBean(HiddenHttpMethodFilter.class)
|
|
|
|
|
public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
|
|
|
|
|
return new HiddenHttpMethodFilter();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static boolean templateExists(Environment environment,
|
|
|
|
|
ResourceLoader resourceLoader, String view) {
|
|
|
|
|
String prefix = environment.getProperty("spring.view.prefix",
|
|
|
|
|
WebMvcAutoConfiguration.DEFAULT_PREFIX);
|
|
|
|
|
String suffix = environment.getProperty("spring.view.suffix",
|
|
|
|
|
WebMvcAutoConfiguration.DEFAULT_SUFFIX);
|
|
|
|
|
return resourceLoader.getResource(prefix + view + suffix).exists();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Defined as a nested config to ensure WebMvcConfigurerAdapter it not read when not
|
|
|
|
|
// on the classpath
|
|
|
|
|
@EnableWebMvc
|
|
|
|
|