Book connected to text
1.4 Configuration of the configuration settings provided
Configuration settings configuration settings to process the source object as follows: SqlSessionFactoryBean → SqlSessionBuilder → XMLConfigBuilder → settingsElement
1 private void settingsElement(Properties props) throws Exception { 2 // 设置 autoMappingBehavior 属性,默认值为 PARTIAL 3 configuration.setAutoMappingBehavior(AutoMappingBehavior.valueOf(props.getProperty("autoMappingBehavior", "PARTIAL"))); 4 configuration.setAutoMappingUnknownColumnBehavior(AutoMappingUnknownColumnBehavior.valueOf(props.getProperty("autoMappingUnknownColumnBehavior", "NONE"))); 5 // 设置 cacheEnabled 属性,默认值为 true 6 configuration.setCacheEnabled(booleanValueOf(props.getProperty("cacheEnabled"), true)); 7 8 //Omit part of the code . 9 10 // parse the default processor enumeration . 11 <? Class the extends the TypeHandler> typeHandler = (<? Class the extends the TypeHandler>) the resolveClass (props.getProperty ( "defaultEnumTypeHandler" )); 12 is // Set default enumeration The processor 13 is configuration.setDefaultEnumTypeHandler (typeHandler); 14 configuration.setCallSettersOnNulls (booleanValueOf (props.getProperty ( "callSettersOnNulls"), to false )); 15 configuration.setUseActualParamName (booleanValueOf (props.getProperty ( "useActualParamName"), to true )); 16 . 17 // omit part of the code 18 }