Spring 是否从那里读取任何配置文件,知道要创建一些默认的开箱即用实现(HandlerMapping
等ViewResolver
)?
问问题
129 次
1 回答
0
是的,DispatcherServlet.properties
在org.springframework.web.servlet
pacakge 中就是您要找的东西。
DispatcherServlet 来源的相关片段:
/**
* Name of the class path resource (relative to the DispatcherServlet class)
* that defines DispatcherServlet's default strategy names.
*/
private static final String DEFAULT_STRATEGIES_PATH ="DispatcherServlet.properties";
....
static {
// Load default strategy implementations from properties file.
// This is currently strictly internal and not meant to be customized
// by application developers.
try {
ClassPathResource resource = new ClassPathResource(DEFAULT_STRATEGIES_PATH, DispatcherServlet.class);
defaultStrategies = PropertiesLoaderUtils.loadProperties(resource);
}
catch (IOException ex) {
throw new IllegalStateException("Could not load 'DispatcherServlet.properties': " + ex.getMessage());
}
}
于 2012-07-30T11:08:00.393 回答