diff options
Diffstat (limited to 'spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java')
-rw-r--r-- | spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java b/spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java index eca9a2fd..384cb0c8 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/config/DatabasePopulatorConfigUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2011 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,6 +32,7 @@ import org.springframework.util.xml.DomUtils; /** * @author Juergen Hoeller + * @author Stephane Nicoll * @since 3.1 */ class DatabasePopulatorConfigUtils { @@ -70,8 +71,9 @@ class DatabasePopulatorConfigUtils { if (StringUtils.hasLength(scriptElement.getAttribute("encoding"))) { delegate.addPropertyValue("sqlScriptEncoding", new TypedStringValue(scriptElement.getAttribute("encoding"))); } - if (StringUtils.hasLength(scriptElement.getAttribute("separator"))) { - delegate.addPropertyValue("separator", new TypedStringValue(scriptElement.getAttribute("separator"))); + String separator = getSeparator(element, scriptElement); + if (separator != null) { + delegate.addPropertyValue("separator", new TypedStringValue(separator)); } delegates.add(delegate.getBeanDefinition()); } @@ -80,4 +82,16 @@ class DatabasePopulatorConfigUtils { return builder.getBeanDefinition(); } + private static String getSeparator(Element element, Element scriptElement) { + String scriptSeparator = scriptElement.getAttribute("separator"); + if (StringUtils.hasLength(scriptSeparator)) { + return scriptSeparator; + } + String elementSeparator = element.getAttribute("separator"); + if (StringUtils.hasLength(elementSeparator)) { + return elementSeparator; + } + return null; + } + } |