|
|
|
@ -37,16 +37,16 @@ import org.springframework.util.StringValueResolver; |
|
|
|
* |
|
|
|
* |
|
|
|
* <pre class="code"> |
|
|
|
* <pre class="code"> |
|
|
|
* <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> |
|
|
|
* <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> |
|
|
|
* <property name="driverClassName" value="${driver}" /> |
|
|
|
* <property name="driverClassName" value="${jdbc.driver}" /> |
|
|
|
* <property name="url" value="jdbc:${dbname}" /> |
|
|
|
* <property name="url" value="jdbc:${jdbc.dbname}" /> |
|
|
|
* </bean> |
|
|
|
* </bean> |
|
|
|
* </pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* Example properties file: |
|
|
|
* Example properties file: |
|
|
|
* |
|
|
|
* |
|
|
|
* <pre class="code"> |
|
|
|
* <pre class="code"> |
|
|
|
* driver=com.mysql.jdbc.Driver |
|
|
|
* jdbc.driver=com.mysql.jdbc.Driver |
|
|
|
* dbname=mysql:mydb</pre> |
|
|
|
* jdbc.dbname=mysql:mydb</pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* Annotated bean definitions may take advantage of property replacement using |
|
|
|
* Annotated bean definitions may take advantage of property replacement using |
|
|
|
* the {@link org.springframework.beans.factory.annotation.Value @Value} annotation: |
|
|
|
* the {@link org.springframework.beans.factory.annotation.Value @Value} annotation: |
|
|
|
@ -79,7 +79,7 @@ import org.springframework.util.StringValueResolver; |
|
|
|
* <p>Example XML property with default value: |
|
|
|
* <p>Example XML property with default value: |
|
|
|
* |
|
|
|
* |
|
|
|
* <pre class="code"> |
|
|
|
* <pre class="code"> |
|
|
|
* <property name="url" value="jdbc:${dbname:defaultdb}" /> |
|
|
|
* <property name="url" value="jdbc:${jdbc.dbname:defaultdb}" /> |
|
|
|
* </pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Chris Beams |
|
|
|
* @author Chris Beams |
|
|
|
@ -103,6 +103,7 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi |
|
|
|
/** Default escape character: {@code '\'}. */ |
|
|
|
/** Default escape character: {@code '\'}. */ |
|
|
|
public static final Character DEFAULT_ESCAPE_CHARACTER = '\\'; |
|
|
|
public static final Character DEFAULT_ESCAPE_CHARACTER = '\\'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** Defaults to {@value #DEFAULT_PLACEHOLDER_PREFIX}. */ |
|
|
|
/** Defaults to {@value #DEFAULT_PLACEHOLDER_PREFIX}. */ |
|
|
|
protected String placeholderPrefix = DEFAULT_PLACEHOLDER_PREFIX; |
|
|
|
protected String placeholderPrefix = DEFAULT_PLACEHOLDER_PREFIX; |
|
|
|
|
|
|
|
|
|
|
|
@ -133,7 +134,7 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the prefix that a placeholder string starts with. |
|
|
|
* Set the prefix that a placeholder string starts with. |
|
|
|
* The default is {@value #DEFAULT_PLACEHOLDER_PREFIX}. |
|
|
|
* <p>The default is {@value #DEFAULT_PLACEHOLDER_PREFIX}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setPlaceholderPrefix(String placeholderPrefix) { |
|
|
|
public void setPlaceholderPrefix(String placeholderPrefix) { |
|
|
|
this.placeholderPrefix = placeholderPrefix; |
|
|
|
this.placeholderPrefix = placeholderPrefix; |
|
|
|
@ -141,26 +142,25 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the suffix that a placeholder string ends with. |
|
|
|
* Set the suffix that a placeholder string ends with. |
|
|
|
* The default is {@value #DEFAULT_PLACEHOLDER_SUFFIX}. |
|
|
|
* <p>The default is {@value #DEFAULT_PLACEHOLDER_SUFFIX}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setPlaceholderSuffix(String placeholderSuffix) { |
|
|
|
public void setPlaceholderSuffix(String placeholderSuffix) { |
|
|
|
this.placeholderSuffix = placeholderSuffix; |
|
|
|
this.placeholderSuffix = placeholderSuffix; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Specify the separating character between the placeholder variable |
|
|
|
* Specify the separating character between the placeholder variable and the |
|
|
|
* and the associated default value, or {@code null} if no such |
|
|
|
* associated default value, or {@code null} if no such special character |
|
|
|
* special character should be processed as a value separator. |
|
|
|
* should be processed as a value separator. |
|
|
|
* The default is {@value #DEFAULT_VALUE_SEPARATOR}. |
|
|
|
* <p>The default is {@value #DEFAULT_VALUE_SEPARATOR}. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setValueSeparator(@Nullable String valueSeparator) { |
|
|
|
public void setValueSeparator(@Nullable String valueSeparator) { |
|
|
|
this.valueSeparator = valueSeparator; |
|
|
|
this.valueSeparator = valueSeparator; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Specify the escape character to use to ignore placeholder prefix |
|
|
|
* Specify the escape character to use to ignore the placeholder prefix or |
|
|
|
* or value separator, or {@code null} if no escaping should take |
|
|
|
* value separator, or {@code null} if no escaping should take place. |
|
|
|
* place. |
|
|
|
|
|
|
|
* <p>Default is {@link #DEFAULT_ESCAPE_CHARACTER}. |
|
|
|
* <p>Default is {@link #DEFAULT_ESCAPE_CHARACTER}. |
|
|
|
* @since 6.2 |
|
|
|
* @since 6.2 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|