@ -87,7 +87,6 @@ public class TypedStringValue implements BeanMetadataElement {
@@ -87,7 +87,6 @@ public class TypedStringValue implements BeanMetadataElement {
*SettheStringvalue.
*<p>Onlynecessaryformanipulatingaregisteredvalue,
*forexampleinBeanFactoryPostProcessors.
*@seePropertyPlaceholderConfigurer
*/
publicvoidsetValue(@NullableStringvalue){
this.value=value;
@ -105,7 +104,6 @@ public class TypedStringValue implements BeanMetadataElement {
@@ -105,7 +104,6 @@ public class TypedStringValue implements BeanMetadataElement {
*Setthetypetoconvertto.
*<p>Onlynecessaryformanipulatingaregisteredvalue,
*forexampleinBeanFactoryPostProcessors.
*@seePropertyPlaceholderConfigurer
*/
publicvoidsetTargetType(Class<?>targetType){
Assert.notNull(targetType,"'targetType' must not be null");
@ -163,7 +163,6 @@ The following example shows the basic structure of XML-based configuration metad
@@ -163,7 +163,6 @@ The following example shows the basic structure of XML-based configuration metad
<2> The `class` attribute defines the type of the bean and uses the fully qualified
classname.
The value of the `id` attribute refers to collaborating objects. The XML for
referring to collaborating objects is not shown in this example. See
<<beans-dependencies,Dependencies>> for more information.
@ -1355,7 +1354,7 @@ You can also configure a `java.util.Properties` instance, as follows:
@@ -1355,7 +1354,7 @@ You can also configure a `java.util.Properties` instance, as follows:
@ -3980,19 +3979,19 @@ to work with bean instances within a `BeanFactoryPostProcessor` (for example, by
@@ -3980,19 +3979,19 @@ to work with bean instances within a `BeanFactoryPostProcessor` (for example, by
standard container lifecycle. This may cause negative side effects, such as bypassing
bean post processing.
Also, `BeanFactoryPostProcessor` instances are scoped per-container. This is only relevant if
you use container hierarchies. If you define a `BeanFactoryPostProcessor` in one
container, it is applied only to the bean definitions in that container. Bean
definitions in one container are not post-processed by `BeanFactoryPostProcessor` instances
in another container, even if both containers are part of the same hierarchy.
Also, `BeanFactoryPostProcessor` instances are scoped per-container. This is only relevant
if you use container hierarchies. If you define a `BeanFactoryPostProcessor` in one
container, it is applied only to the bean definitions in that container. Bean definitions
in one container are not post-processed by `BeanFactoryPostProcessor` instances in another
container, even if both containers are part of the same hierarchy.
====
A bean factory post-processor is automatically executed when it is declared inside an
`ApplicationContext`, in order to apply changes to the configuration metadata that
define the container. Spring includes a number of predefined bean factory
post-processors, such as `PropertyOverrideConfigurer` and
`PropertyPlaceholderConfigurer`. You can also use a custom `BeanFactoryPostProcessor` --
for example, to register custom property editors.
`PropertySourcesPlaceholderConfigurer`. You can also use a custom `BeanFactoryPostProcessor`
-- for example, to register custom property editors.
An `ApplicationContext` automatically detects any beans that are deployed into it that
implement the `BeanFactoryPostProcessor` interface. It uses these beans as bean factory
@ -4008,13 +4007,13 @@ Thus, marking it for lazy initialization will be ignored, and the
@@ -4008,13 +4007,13 @@ Thus, marking it for lazy initialization will be ignored, and the
[[beans-factory-placeholderconfigurer]]
==== Example: The Class Name Substitution `PropertyPlaceholderConfigurer`
==== Example: The Class Name Substitution `PropertySourcesPlaceholderConfigurer`
You can use the `PropertyPlaceholderConfigurer` to externalize property values from a bean
definition in a separate file by using the standard Java `Properties` format. Doing so
enables the person deploying an application to customize environment-specific properties,
such as database URLs and passwords, without the complexity or risk of modifying the
main XML definition file or files for the container.
You can use the `PropertySourcesPlaceholderConfigurer` to externalize property values
from a bean definition in a separate file by using the standard Java `Properties` format.
Doing so enables the person deploying an application to customize environment-specific
properties, such as database URLs and passwords, without the complexity or risk of
modifying the main XML definition file or files for the container.
Consider the following XML-based configuration metadata fragment, where a `DataSource`
with placeholder values is defined:
@ -4022,7 +4021,7 @@ with placeholder values is defined:
@@ -4022,7 +4021,7 @@ with placeholder values is defined:
Therefore, the `${jdbc.username}` string is replaced at runtime with the value, 'sa', and
the same applies for other placeholder values that match keys in the properties file.
The `PropertyPlaceholderConfigurer` checks for placeholders in most properties and
The `PropertySourcesPlaceholderConfigurer` checks for placeholders in most properties and
attributes of a bean definition. Furthermore, you can customize the placeholder prefix and suffix.
With the `context` namespace introduced in Spring 2.5, you can configure
property placeholders with a dedicated configuration element. You can provide one or more locations
as a comma-separated list in the `location` attribute, as the following example shows:
With the `context` namespace introduced in Spring 2.5, you can configure property placeholders
with a dedicated configuration element. You can provide one or more locations as a
comma-separated list in the `location` attribute, as the following example shows:
[source,xml,indent=0]
[subs="verbatim,quotes"]
@ -4067,30 +4065,20 @@ as a comma-separated list in the `location` attribute, as the following example
@@ -4067,30 +4065,20 @@ as a comma-separated list in the `location` attribute, as the following example
@ -4112,8 +4100,8 @@ phase of an `ApplicationContext` for a non-lazy-init bean.
@@ -4112,8 +4100,8 @@ phase of an `ApplicationContext` for a non-lazy-init bean.
==== Example: The `PropertyOverrideConfigurer`
The `PropertyOverrideConfigurer`, another bean factory post-processor, resembles the
`PropertyPlaceholderConfigurer`, but unlike the latter, the original definitions can
have default values or no values at all for bean properties. If an overriding
`PropertySourcesPlaceholderConfigurer`, but unlike the latter, the original definitions
can have default values or no values at all for bean properties. If an overriding
`Properties` file does not have an entry for a certain bean property, the default
context definition is used.
@ -9030,7 +9018,7 @@ you need to call its `postProcessBeanFactory` method, as the following example s
@@ -9030,7 +9018,7 @@ you need to call its `postProcessBeanFactory` method, as the following example s