UML
關鍵代碼
1、啓動spring
private static void base() {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
new String[] { "classpath:applicationContext.xml" });
context.start();
}
2、ClassPathXmlApplicationContext中
public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent)
throws BeansException {
super(parent);
//設置默認的環境(包括默認的轉換器及對路徑表達式的解析)
setConfigLocations(configLocations);
if (refresh) {
refresh();
}
}
3、AbstractRefreshableConfigApplicationContext中
protected String resolvePath(String path) {
//獲取默認環境配置及轉換路徑中的表達式
return getEnvironment().resolveRequiredPlaceholders(path);
}
4、DefaultConversionService類中
public static void addDefaultConverters(ConverterRegistry converterRegistry) {
addScalarConverters(converterRegistry);
addCollectionConverters(converterRegistry);
converterRegistry.addConverter(new ByteBufferConverter((ConversionService) converterRegistry));
if (jsr310Available) {
Jsr310ConverterRegistrar.registerJsr310Converters(converterRegistry);
}
converterRegistry.addConverter(new ObjectToObjectConverter());
converterRegistry.addConverter(new IdToEntityConverter((ConversionService) converterRegistry));
converterRegistry.addConverter(new FallbackObjectToStringConverter());
if (javaUtilOptionalClassAvailable) {
converterRegistry.addConverter(new ObjectToOptionalConverter((ConversionService) converterRegistry));
}
}