|
|
|
@ -1,5 +1,5 @@ |
|
|
|
/* |
|
|
|
/* |
|
|
|
* Copyright 2002-2013 the original author or authors. |
|
|
|
* Copyright 2002-2015 the original author or authors. |
|
|
|
* |
|
|
|
* |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
* you may not use this file except in compliance with the License. |
|
|
|
@ -30,33 +30,33 @@ import org.springframework.util.StringValueResolver; |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>The default placeholder syntax follows the Ant / Log4J / JSP EL style: |
|
|
|
* <p>The default placeholder syntax follows the Ant / Log4J / JSP EL style: |
|
|
|
* |
|
|
|
* |
|
|
|
*<pre class="code">${...}</pre> |
|
|
|
* <pre class="code">${...}</pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* Example XML bean definition: |
|
|
|
* Example XML bean definition: |
|
|
|
* |
|
|
|
* |
|
|
|
*<pre class="code">{@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}{@code "/> |
|
|
|
* <property name="driverClassName" value="${driver}"/> |
|
|
|
* <property name="url" value="jdbc:}${dbname}{@code "/> |
|
|
|
* <property name="url" value="jdbc:${dbname}"/> |
|
|
|
*</bean> |
|
|
|
* </bean> |
|
|
|
*}</pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* Example properties file: |
|
|
|
* Example properties file: |
|
|
|
* |
|
|
|
* |
|
|
|
* <pre class="code"> driver=com.mysql.jdbc.Driver |
|
|
|
* <pre class="code">driver=com.mysql.jdbc.Driver |
|
|
|
* dbname=mysql:mydb</pre> |
|
|
|
* 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: |
|
|
|
* |
|
|
|
* |
|
|
|
*<pre class="code">@Value("${person.age}")</pre> |
|
|
|
* <pre class="code">@Value("${person.age}")</pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* Implementations check simple property values, lists, maps, props, and bean names |
|
|
|
* Implementations check simple property values, lists, maps, props, and bean names |
|
|
|
* in bean references. Furthermore, placeholder values can also cross-reference |
|
|
|
* in bean references. Furthermore, placeholder values can also cross-reference |
|
|
|
* other placeholders, like: |
|
|
|
* other placeholders, like: |
|
|
|
* |
|
|
|
* |
|
|
|
*<pre class="code">rootPath=myrootdir |
|
|
|
* <pre class="code">rootPath=myrootdir |
|
|
|
*subPath=${rootPath}/subdir</pre> |
|
|
|
* subPath=${rootPath}/subdir</pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* In contrast to {@link PropertyOverrideConfigurer}, subclasses of this type allow |
|
|
|
* In contrast to {@link PropertyOverrideConfigurer}, subclasses of this type allow |
|
|
|
* filling in of explicit placeholders in bean definitions. |
|
|
|
* filling in of explicit placeholders in bean definitions. |
|
|
|
@ -75,9 +75,9 @@ import org.springframework.util.StringValueResolver; |
|
|
|
* |
|
|
|
* |
|
|
|
* <p>Example XML property with default value: |
|
|
|
* <p>Example XML property with default value: |
|
|
|
* |
|
|
|
* |
|
|
|
*<pre class="code">{@code |
|
|
|
* <pre class="code"> |
|
|
|
* <property name="url" value="jdbc:}${dbname:defaultdb}{@code "/> |
|
|
|
* <property name="url" value="jdbc:${dbname:defaultdb}"/> |
|
|
|
*}</pre> |
|
|
|
* </pre> |
|
|
|
* |
|
|
|
* |
|
|
|
* @author Chris Beams |
|
|
|
* @author Chris Beams |
|
|
|
* @author Juergen Hoeller |
|
|
|
* @author Juergen Hoeller |
|
|
|
@ -107,14 +107,14 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi |
|
|
|
/** Defaults to {@value #DEFAULT_VALUE_SEPARATOR} */ |
|
|
|
/** Defaults to {@value #DEFAULT_VALUE_SEPARATOR} */ |
|
|
|
protected String valueSeparator = DEFAULT_VALUE_SEPARATOR; |
|
|
|
protected String valueSeparator = DEFAULT_VALUE_SEPARATOR; |
|
|
|
|
|
|
|
|
|
|
|
protected boolean ignoreUnresolvablePlaceholders = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected String nullValue; |
|
|
|
protected String nullValue; |
|
|
|
|
|
|
|
|
|
|
|
private BeanFactory beanFactory; |
|
|
|
protected boolean ignoreUnresolvablePlaceholders = false; |
|
|
|
|
|
|
|
|
|
|
|
private String beanName; |
|
|
|
private String beanName; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private BeanFactory beanFactory; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the prefix that a placeholder string starts with. |
|
|
|
* Set the prefix that a placeholder string starts with. |
|
|
|
@ -143,13 +143,13 @@ public abstract class PlaceholderConfigurerSupport extends PropertyResourceConfi |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set a value that should be treated as {@code null} when |
|
|
|
* Set a value that should be treated as {@code null} when resolved |
|
|
|
* resolved as a placeholder value: e.g. "" (empty String) or "null". |
|
|
|
* as a placeholder value: e.g. "" (empty String) or "null". |
|
|
|
* <p>Note that this will only apply to full property values, |
|
|
|
* <p>Note that this will only apply to full property values, |
|
|
|
* not to parts of concatenated values. |
|
|
|
* not to parts of concatenated values. |
|
|
|
* <p>By default, no such null value is defined. This means that |
|
|
|
* <p>By default, no such null value is defined. This means that |
|
|
|
* there is no way to express {@code null} as a property |
|
|
|
* there is no way to express {@code null} as a property value |
|
|
|
* value unless you explicitly map a corresponding value here. |
|
|
|
* unless you explicitly map a corresponding value here. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public void setNullValue(String nullValue) { |
|
|
|
public void setNullValue(String nullValue) { |
|
|
|
this.nullValue = nullValue; |
|
|
|
this.nullValue = nullValue; |
|
|
|
|