@@ -5233,9 +5233,9 @@ method parameters, as shown in the following example:
5233
5233
----
5234
5234
public class MovieRecommender {
5235
5235
5236
- private MovieCatalog movieCatalog;
5236
+ private final MovieCatalog movieCatalog;
5237
5237
5238
- private CustomerPreferenceDao customerPreferenceDao;
5238
+ private final CustomerPreferenceDao customerPreferenceDao;
5239
5239
5240
5240
@Autowired
5241
5241
public void prepare(@Qualifier("main") MovieCatalog movieCatalog,
@@ -5492,7 +5492,6 @@ the simple annotation, as the following example shows:
5492
5492
@Retention(RetentionPolicy.RUNTIME)
5493
5493
@Qualifier
5494
5494
public @interface Offline {
5495
-
5496
5495
}
5497
5496
----
5498
5497
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
@@ -8094,7 +8093,7 @@ class AppConfig {
8094
8093
By default, beans defined with Java configuration that have a public `close` or `shutdown`
8095
8094
method are automatically enlisted with a destruction callback. If you have a public
8096
8095
`close` or `shutdown` method and you do not wish for it to be called when the container
8097
- shuts down, you can add `@Bean(destroyMethod= "")` to your bean definition to disable the
8096
+ shuts down, you can add `@Bean(destroyMethod = "")` to your bean definition to disable the
8098
8097
default `(inferred)` mode.
8099
8098
8100
8099
You may want to do that by default for a resource that you acquire with JNDI, as its
@@ -8107,7 +8106,7 @@ The following example shows how to prevent an automatic destruction callback for
8107
8106
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
8108
8107
.Java
8109
8108
----
8110
- @Bean(destroyMethod= "")
8109
+ @Bean(destroyMethod = "")
8111
8110
public DataSource dataSource() throws NamingException {
8112
8111
return (DataSource) jndiTemplate.lookup("MyDS");
8113
8112
}
@@ -9451,7 +9450,7 @@ now looks like the following listing:
9451
9450
[source,java,indent=0,subs="verbatim,quotes",role="primary"]
9452
9451
.Java
9453
9452
----
9454
- @Bean(destroyMethod= "")
9453
+ @Bean(destroyMethod = "")
9455
9454
public DataSource dataSource() throws Exception {
9456
9455
Context ctx = new InitialContext();
9457
9456
return (DataSource) ctx.lookup("java:comp/env/jdbc/datasource");
@@ -9532,27 +9531,30 @@ can rewrite the `dataSource` configuration as follows:
9532
9531
@Profile("production")
9533
9532
public class JndiDataConfig {
9534
9533
9535
- @Bean(destroyMethod= "")
9534
+ @Bean(destroyMethod = "") // <1>
9536
9535
public DataSource dataSource() throws Exception {
9537
9536
Context ctx = new InitialContext();
9538
9537
return (DataSource) ctx.lookup("java:comp/env/jdbc/datasource");
9539
9538
}
9540
9539
}
9541
9540
----
9541
+ <1> `@Bean(destroyMethod = "")` disables default destroy method inference.
9542
+
9542
9543
[source,kotlin,indent=0,subs="verbatim,quotes",role="secondary"]
9543
9544
.Kotlin
9544
9545
----
9545
9546
@Configuration
9546
9547
@Profile("production")
9547
9548
class JndiDataConfig {
9548
9549
9549
- @Bean(destroyMethod = "")
9550
+ @Bean(destroyMethod = "") // <1>
9550
9551
fun dataSource(): DataSource {
9551
9552
val ctx = InitialContext()
9552
9553
return ctx.lookup("java:comp/env/jdbc/datasource") as DataSource
9553
9554
}
9554
9555
}
9555
9556
----
9557
+ <1> `@Bean(destroyMethod = "")` disables default destroy method inference.
9556
9558
9557
9559
NOTE: As mentioned earlier, with `@Bean` methods, you typically choose to use programmatic
9558
9560
JNDI lookups, by using either Spring's `JndiTemplate`/`JndiLocatorDelegate` helpers or the
@@ -9564,9 +9566,9 @@ profile expression. A profile expression allows for more complicated profile log
9564
9566
expressed (for example, `production & us-east`). The following operators are supported in
9565
9567
profile expressions:
9566
9568
9567
- * `!`: A logical "`not`" of the profile
9568
- * `&`: A logical "`and`" of the profiles
9569
- * `|`: A logical "`or`" of the profiles
9569
+ * `!`: A logical `NOT` of the profile
9570
+ * `&`: A logical `AND` of the profiles
9571
+ * `|`: A logical `OR` of the profiles
9570
9572
9571
9573
NOTE: You cannot mix the `&` and `|` operators without using parentheses. For example,
9572
9574
`production & us-east | eu-central` is not a valid expression. It must be expressed as
@@ -9829,7 +9831,7 @@ activates multiple profiles:
9829
9831
Declaratively, `spring.profiles.active` may accept a comma-separated list of profile names,
9830
9832
as the following example shows:
9831
9833
9832
- [literal,subs="verbatim,quotes"]
9834
+ [literal,indent=0, subs="verbatim,quotes"]
9833
9835
----
9834
9836
-Dspring.profiles.active="profile1,profile2"
9835
9837
----
@@ -10225,13 +10227,13 @@ handled in the JDK-standard way of resolving messages through `ResourceBundle` o
10225
10227
purposes of the example, assume the contents of two of the above resource bundle files
10226
10228
are as follows:
10227
10229
10228
- [literal ,subs="verbatim,quotes"]
10230
+ [source,properties,indent=0 ,subs="verbatim,quotes"]
10229
10231
----
10230
10232
# in format.properties
10231
10233
message=Alligators rock!
10232
10234
----
10233
10235
10234
- [literal ,subs="verbatim,quotes"]
10236
+ [source,properties,indent=0 ,subs="verbatim,quotes"]
10235
10237
----
10236
10238
# in exceptions.properties
10237
10239
argument.required=The {0} argument is required.
0 commit comments