@@ -5263,6 +5263,7 @@ named "customerPreferenceDao" and then falls back to a primary type match for th
5263
5263
----
5264
5264
5265
5265
With the following configuration:
5266
+
5266
5267
[source,java,indent=0]
5267
5268
[subs="verbatim,quotes"]
5268
5269
----
@@ -5272,6 +5273,7 @@ With the following configuration:
5272
5273
----
5273
5274
5274
5275
And the following `application.properties` file:
5276
+
5275
5277
[source,java,indent=0]
5276
5278
[subs="verbatim,quotes"]
5277
5279
----
@@ -5282,7 +5284,7 @@ In that case, the `catalog` parameter and field will be equal to the `MovieCatal
5282
5284
5283
5285
A default lenient embedded value resolver is provided by Spring. It will try to resolve the
5284
5286
property value and if it cannot be resolved, the property name (for example `${catalog.name}`)
5285
- will be injected as the value. If you want to maintain strict control over non existent
5287
+ will be injected as the value. If you want to maintain strict control over nonexistent
5286
5288
values, you should declare a `PropertySourcesPlaceholderConfigurer` bean, as the following
5287
5289
example shows:
5288
5290
@@ -5293,22 +5295,26 @@ example shows:
5293
5295
public class AppConfig {
5294
5296
5295
5297
@Bean
5296
- public PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
5298
+ public static PropertySourcesPlaceholderConfigurer propertyPlaceholderConfigurer() {
5297
5299
return new PropertySourcesPlaceholderConfigurer();
5298
5300
}
5299
5301
}
5300
5302
----
5301
5303
5302
- Using the above configuration ensures Spring initialization failure if any of `${}`
5304
+ NOTE: When configuring a `PropertySourcesPlaceholderConfigurer` using JavaConfig, the
5305
+ `@Bean` method must be `static`.
5306
+
5307
+ Using the above configuration ensures Spring initialization failure if any `${}`
5303
5308
placeholder could not be resolved. It is also possible to use methods like
5304
- `setPlaceholderPrefix`, `setPlaceholderSuffix` or `setValueSeparator` to customize placeholders.
5309
+ `setPlaceholderPrefix`, `setPlaceholderSuffix`, or `setValueSeparator` to customize
5310
+ placeholders.
5305
5311
5306
5312
NOTE: Spring Boot configures by default a `PropertySourcesPlaceholderConfigurer` bean that
5307
5313
will get properties from `application.properties` and `application.yml` files.
5308
5314
5309
5315
Built-in converter support provided by Spring allows simple type conversion (to `Integer`
5310
- or `int` for example) to be automatically handled. Multiple comma separated values parameter
5311
- can be automatically converted to String array without extra effort.
5316
+ or `int` for example) to be automatically handled. Multiple comma- separated values can be
5317
+ automatically converted to String array without extra effort.
5312
5318
5313
5319
It is possible to provide a default value as following:
5314
5320
@@ -5326,10 +5332,10 @@ It is possible to provide a default value as following:
5326
5332
}
5327
5333
----
5328
5334
5329
- Spring BeanPostProcessor uses ConversionService instance behind the scene to handle the
5330
- process from converting `@Value` value to the target type. If you want to provide conversion
5331
- support for your own custom type, you can provide your own ConversionService bean instance
5332
- as the following example shows:
5335
+ A Spring ` BeanPostProcessor` uses a `ConversionService` behind the scene to handle the
5336
+ process for converting the String value in `@Value` to the target type. If you want to
5337
+ provide conversion support for your own custom type, you can provide your own
5338
+ `ConversionService` bean instance as the following example shows:
5333
5339
5334
5340
[source,java,indent=0]
5335
5341
[subs="verbatim,quotes"]
@@ -5346,8 +5352,8 @@ as the following example shows:
5346
5352
}
5347
5353
----
5348
5354
5349
- <<expressions, `SpEL` expression>> built-in support allows dynamically computed `@Value`
5350
- at runtime as in the following example shows:
5355
+ When `@Value` contains a <<expressions, `SpEL` expression>> the value will be dynamically
5356
+ computed at runtime as the following example shows:
5351
5357
5352
5358
[source,java,indent=0]
5353
5359
[subs="verbatim,quotes"]
@@ -5357,13 +5363,13 @@ at runtime as in the following example shows:
5357
5363
5358
5364
private final String catalog;
5359
5365
5360
- public MovieRecommender(@Value("#{systemProperties['user.catalog'] + 'Catalog' }") String catalog){
5366
+ public MovieRecommender(@Value("#{systemProperties['user.catalog'] + 'Catalog' }") String catalog) {
5361
5367
this.catalog = catalog;
5362
5368
}
5363
5369
}
5364
5370
----
5365
5371
5366
- SpEL also enables to use more complex data structure :
5372
+ SpEL also enables the use of more complex data structures :
5367
5373
5368
5374
[source,java,indent=0]
5369
5375
[subs="verbatim,quotes"]
0 commit comments