diff --git a/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java b/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java index c55ea66298e..a9ca156c647 100644 --- a/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java +++ b/src/main/java/org/apache/ibatis/builder/xml/XMLConfigBuilder.java @@ -268,6 +268,7 @@ private void settingsElement(Properties props) { configuration.setReturnInstanceForEmptyRow(booleanValueOf(props.getProperty("returnInstanceForEmptyRow"), false)); configuration.setLogPrefix(props.getProperty("logPrefix")); configuration.setConfigurationFactory(resolveClass(props.getProperty("configurationFactory"))); + configuration.setShrinkWhitespacesInSql(booleanValueOf(props.getProperty("shrinkWhitespacesInSql"), false)); } private void environmentsElement(XNode context) throws Exception { diff --git a/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml b/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml index d816fe95fa4..80da190a796 100644 --- a/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml +++ b/src/test/java/org/apache/ibatis/builder/CustomizedSettingsMapperConfig.xml @@ -54,6 +54,7 @@ + diff --git a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java index a1453ac5273..ef1851130dd 100644 --- a/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java +++ b/src/test/java/org/apache/ibatis/builder/XmlConfigBuilderTest.java @@ -100,6 +100,7 @@ void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception { assertNull(config.getLogImpl()); assertNull(config.getConfigurationFactory()); assertThat(config.getTypeHandlerRegistry().getTypeHandler(RoundingMode.class)).isInstanceOf(EnumTypeHandler.class); + assertThat(config.isShrinkWhitespacesInSql()).isFalse(); } } @@ -194,6 +195,7 @@ void shouldSuccessfullyLoadXMLConfigFile() throws Exception { assertThat(config.getLogImpl().getName()).isEqualTo(Slf4jImpl.class.getName()); assertThat(config.getVfsImpl().getName()).isEqualTo(JBoss6VFS.class.getName()); assertThat(config.getConfigurationFactory().getName()).isEqualTo(String.class.getName()); + assertThat(config.isShrinkWhitespacesInSql()).isTrue(); assertThat(config.getTypeAliasRegistry().getTypeAliases().get("blogauthor")).isEqualTo(Author.class); assertThat(config.getTypeAliasRegistry().getTypeAliases().get("blog")).isEqualTo(Blog.class); diff --git a/src/test/java/org/apache/ibatis/builder/xsd/CustomizedSettingsMapperConfig.xml b/src/test/java/org/apache/ibatis/builder/xsd/CustomizedSettingsMapperConfig.xml index 4114fff0dea..b77b7521ca8 100644 --- a/src/test/java/org/apache/ibatis/builder/xsd/CustomizedSettingsMapperConfig.xml +++ b/src/test/java/org/apache/ibatis/builder/xsd/CustomizedSettingsMapperConfig.xml @@ -50,6 +50,7 @@ + diff --git a/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java b/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java index 60bce8aa492..c4a8a35f642 100644 --- a/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java +++ b/src/test/java/org/apache/ibatis/builder/xsd/XmlConfigBuilderTest.java @@ -84,6 +84,7 @@ void shouldSuccessfullyLoadMinimalXMLConfigFile() throws Exception { assertNull(config.getLogPrefix()); assertNull(config.getLogImpl()); assertNull(config.getConfigurationFactory()); + assertFalse(config.isShrinkWhitespacesInSql()); } finally { // System.clearProperty(XPathParser.KEY_USE_XSD); } @@ -121,6 +122,7 @@ void shouldSuccessfullyLoadXMLConfigFile() throws Exception { assertEquals(Slf4jImpl.class.getName(), config.getLogImpl().getName()); assertEquals(JBoss6VFS.class.getName(), config.getVfsImpl().getName()); assertEquals(String.class.getName(), config.getConfigurationFactory().getName()); + assertTrue(config.isShrinkWhitespacesInSql()); assertEquals(Author.class, config.getTypeAliasRegistry().getTypeAliases().get("blogauthor")); assertEquals(Blog.class, config.getTypeAliasRegistry().getTypeAliases().get("blog"));