Skip to content

Commit a9240e0

Browse files
committed
Document all supported SpringProperties keys in the reference manual
Closes spring-projectsgh-26554
1 parent 262b7d7 commit a9240e0

File tree

6 files changed

+114
-27
lines changed

6 files changed

+114
-27
lines changed

src/docs/asciidoc/appendix.adoc

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
[[appendix]]
2+
= Appendix
3+
:doc-root: https://docs.spring.io
4+
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
5+
:toc: left
6+
:toclevels: 4
7+
:tabsize: 4
8+
:docinfo1:
9+
10+
This part of the reference documentation covers topics that apply to multiple modules
11+
within the core Spring Framework.
12+
13+
14+
[[appendix-spring-properties]]
15+
== Spring Properties
16+
17+
{api-spring-framework}/core/SpringProperties.html[`SpringProperties`] is a static holder
18+
for properties that control certain low-level aspects of the Spring Framework. Users can
19+
configure these properties via JVM system properties or programmatically via the
20+
`SpringProperties.setProperty(String key, String value)` method. The latter may be
21+
necessary if the deployment environment disallows custom JVM system properties. As an
22+
alternative, these properties may be configured in a `spring.properties` file in the root
23+
of the classpath -- for example, deployed within the application's JAR file.
24+
25+
The following table lists all currently supported Spring properties.
26+
27+
.Supported Spring Properties
28+
|===
29+
| Name | Description
30+
31+
| `spring.beaninfo.ignore`
32+
| Instructs Spring to use the `Introspector.IGNORE_ALL_BEANINFO` mode when calling the
33+
JavaBeans `Introspector`. See
34+
{api-spring-framework}++/beans/CachedIntrospectionResults.html#IGNORE_BEANINFO_PROPERTY_NAME++[`CachedIntrospectionResults`]
35+
for details.
36+
37+
| `spring.expression.compiler.mode`
38+
| The mode to use when compiling expressions for the
39+
<<core.adoc#expressions-compiler-configuration, Spring Expression Language>>.
40+
41+
| `spring.getenv.ignore`
42+
| Instructs Spring to ignore operating system environment variables if a Spring
43+
`Environment` property -- for example, a placeholder in a configuration String -- isn't
44+
resolvable otherwise. See
45+
{api-spring-framework}++/core/env/AbstractEnvironment.html#IGNORE_GETENV_PROPERTY_NAME++[`AbstractEnvironment`]
46+
for details.
47+
48+
| `spring.index.ignore`
49+
| Instructs Spring to ignore the components index located in
50+
`META-INF/spring.components`. See <<core.adoc#beans-scanning-index, Generating an Index
51+
of Candidate Components>>.
52+
53+
| `spring.jdbc.getParameterType.ignore`
54+
| Instructs Spring to ignore `java.sql.ParameterMetaData.getParameterType` completely.
55+
See the note in <<data-access.adoc#jdbc-batch-list, Batch Operations with a List of Objects>>.
56+
57+
| `spring.jndi.ignore`
58+
| Instructs Spring to ignore a default JNDI environment, as an optimization for scenarios
59+
where nothing is ever to be found for such JNDI fallback searches to begin with, avoiding
60+
the repeated JNDI lookup overhead. See
61+
{api-spring-framework}++/jndi/JndiLocatorDelegate.html#IGNORE_JNDI_PROPERTY_NAME++[`JndiLocatorDelegate`]
62+
for details.
63+
64+
| `spring.objenesis.ignore`
65+
| Instructs Spring to ignore Objenesis, not even attempting to use it. See
66+
{api-spring-framework}++/objenesis/SpringObjenesis.html#IGNORE_OBJENESIS_PROPERTY_NAME++[`SpringObjenesis`]
67+
for details.
68+
69+
| `spring.test.constructor.autowire.mode`
70+
| The default _test constructor autowire mode_ to use if `@TestConstructor` is not present
71+
on a test class. See <<testing.adoc#integration-testing-annotations-testconstructor,
72+
Changing the default test constructor autowire mode>>.
73+
74+
| `spring.test.context.cache.maxSize`
75+
| The maximum size of the context cache in the _Spring TestContext Framework_. See
76+
<<testing.adoc#testcontext-ctx-management-caching, Context Caching>>.
77+
78+
| `spring.test.enclosing.configuration`
79+
| The default _enclosing configuration inheritance mode_ to use if
80+
`@NestedTestConfiguration` is not present on a test class. See
81+
<<testing.adoc#integration-testing-annotations-nestedtestconfiguration, Changing the
82+
default enclosing configuration inheritance mode>>.
83+
84+
|===

src/docs/asciidoc/core/core-beans.adoc

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7120,10 +7120,10 @@ metadata is provided per-instance rather than per-class.
71207120

71217121
While classpath scanning is very fast, it is possible to improve the startup performance
71227122
of large applications by creating a static list of candidates at compilation time. In this
7123-
mode, all modules that are target of component scan must use this mechanism.
7123+
mode, all modules that are targets of component scanning must use this mechanism.
71247124

7125-
NOTE: Your existing `@ComponentScan` or `<context:component-scan` directives must stay as
7126-
is to request the context to scan candidates in certain packages. When the
7125+
NOTE: Your existing `@ComponentScan` or `<context:component-scan/>` directives must remain
7126+
unchanged to request the context to scan candidates in certain packages. When the
71277127
`ApplicationContext` detects such an index, it automatically uses it rather than scanning
71287128
the classpath.
71297129

@@ -7152,32 +7152,31 @@ configuration, as shown in the following example:
71527152
compileOnly "org.springframework:spring-context-indexer:{spring-version}"
71537153
}
71547154
----
7155-
====
71567155

71577156
With Gradle 4.6 and later, the dependency should be declared in the `annotationProcessor`
71587157
configuration, as shown in the following example:
71597158

7160-
====
71617159
[source,groovy,indent=0subs="verbatim,quotes,attributes"]
71627160
----
71637161
dependencies {
71647162
annotationProcessor "org.springframework:spring-context-indexer:{spring-version}"
71657163
}
71667164
----
71677165

7168-
That process generates a `META-INF/spring.components` file that is
7169-
included in the jar file.
7166+
The `spring-context-indexer` artifact generates a `META-INF/spring.components` file that
7167+
is included in the jar file.
71707168

71717169
NOTE: When working with this mode in your IDE, the `spring-context-indexer` must be
71727170
registered as an annotation processor to make sure the index is up-to-date when
71737171
candidate components are updated.
71747172

7175-
TIP: The index is enabled automatically when a `META-INF/spring.components` is found
7173+
TIP: The index is enabled automatically when a `META-INF/spring.components` file is found
71767174
on the classpath. If an index is partially available for some libraries (or use cases)
7177-
but could not be built for the whole application, you can fallback to a regular classpath
7178-
arrangement (as though no index was present at all) by setting `spring.index.ignore` to
7179-
`true`, either as a system property or in a `spring.properties` file at the root of the
7180-
classpath.
7175+
but could not be built for the whole application, you can fall back to a regular classpath
7176+
arrangement (as though no index were present at all) by setting `spring.index.ignore` to
7177+
`true`, either as a JVM system property or via the
7178+
<<appendix.adoc#appendix-spring-properties,`SpringProperties`>> mechanism.
7179+
71817180

71827181

71837182

src/docs/asciidoc/core/core-expressions.adoc

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,9 +433,9 @@ interpreter and only 3ms using the compiled version of the expression.
433433

434434
The compiler is not turned on by default, but you can turn it on in either of two
435435
different ways. You can turn it on by using the parser configuration process
436-
(<<expressions-parser-configuration, discussed earlier>>) or by using a system
437-
property when SpEL usage is embedded inside another component. This section
438-
discusses both of these options.
436+
(<<expressions-parser-configuration, discussed earlier>>) or by using a Spring property
437+
when SpEL usage is embedded inside another component. This section discusses both of
438+
these options.
439439

440440
The compiler can operate in one of three modes, which are captured in the
441441
`org.springframework.expression.spel.SpelCompilerMode` enum. The modes are as follows:
@@ -496,10 +496,12 @@ It is important to ensure that, if a classloader is specified, it can see all th
496496
the expression evaluation process. If you do not specify a classloader, a default classloader is used
497497
(typically the context classloader for the thread that is running during expression evaluation).
498498

499-
The second way to configure the compiler is for use when SpEL is embedded inside some other
500-
component and it may not be possible to configure it through a configuration object. In these
501-
cases, it is possible to use a system property. You can set the `spring.expression.compiler.mode`
502-
property to one of the `SpelCompilerMode` enum values (`off`, `immediate`, or `mixed`).
499+
The second way to configure the compiler is for use when SpEL is embedded inside some
500+
other component and it may not be possible to configure it through a configuration
501+
object. In these cases, it is possible to set the `spring.expression.compiler.mode`
502+
property via a JVM system property (or via the
503+
<<appendix.adoc#appendix-spring-properties,`SpringProperties`>> mechanism) to one of the
504+
`SpelCompilerMode` enum values (`off`, `immediate`, or `mixed`).
503505

504506

505507
[[expressions-compiler-limitations]]

src/docs/asciidoc/data-access.adoc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4463,13 +4463,14 @@ While this usually works well, there is a potential for issues (for example, wit
44634463
`null` values). Spring, by default, calls `ParameterMetaData.getParameterType` in such a
44644464
case, which can be expensive with your JDBC driver. You should use a recent driver
44654465
version and consider setting the `spring.jdbc.getParameterType.ignore` property to `true`
4466-
(as a JVM system property or in a `spring.properties` file in the root of your classpath)
4467-
if you encounter a performance issue (as reported on Oracle 12c, JBoss and PostgreSQL).
4466+
(as a JVM system property or via the
4467+
<<appendix.adoc#appendix-spring-properties,`SpringProperties`>> mechanism) if you encounter
4468+
a performance issue (as reported on Oracle 12c, JBoss, and PostgreSQL).
44684469
44694470
Alternatively, you might consider specifying the corresponding JDBC types explicitly,
4470-
either through a 'BatchPreparedStatementSetter' (as shown earlier), through an explicit type
4471-
array given to a 'List<Object[]>' based call, through 'registerSqlType' calls on a
4472-
custom 'MapSqlParameterSource' instance, or through a 'BeanPropertySqlParameterSource'
4471+
either through a `BatchPreparedStatementSetter` (as shown earlier), through an explicit type
4472+
array given to a `List<Object[]>` based call, through `registerSqlType` calls on a
4473+
custom `MapSqlParameterSource` instance, or through a `BeanPropertySqlParameterSource`
44734474
that derives the SQL type from the Java-declared property type even for a null value.
44744475
====
44754476

src/docs/asciidoc/index.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ WebSocket, RSocket.
2424
<<integration.adoc#spring-integration, Integration>> :: Remoting, JMS, JCA, JMX,
2525
Email, Tasks, Scheduling, Caching.
2626
<<languages.adoc#languages, Languages>> :: Kotlin, Groovy, Dynamic Languages.
27+
<<appendix.adoc#appendix, Appendix>> :: miscellaneous topics.
2728

2829
Rod Johnson, Juergen Hoeller, Keith Donald, Colin Sampaleanu, Rob Harrop, Thomas Risberg,
2930
Alef Arendsen, Darren Davison, Dmitriy Kopylenko, Mark Pollack, Thierry Templier, Erwin

src/docs/asciidoc/testing.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,7 @@ constructor takes precedence over both `@TestConstructor` and the default mode.
18471847
The default _test constructor autowire mode_ can be changed by setting the
18481848
`spring.test.constructor.autowire.mode` JVM system property to `all`. Alternatively, the
18491849
default mode may be set via the
1850-
{api-spring-framework}/core/SpringProperties.html[`SpringProperties`] mechanism.
1850+
<<appendix.adoc#appendix-spring-properties,`SpringProperties`>> mechanism.
18511851
18521852
As of Spring Framework 5.3, the default mode may also be configured as a
18531853
https://junit.org/junit5/docs/current/user-guide/#running-tests-config-params[JUnit Platform configuration parameter].
@@ -1880,7 +1880,7 @@ change the default mode.
18801880
The default _enclosing configuration inheritance mode_ is `INHERIT`, but it can be
18811881
changed by setting the `spring.test.enclosing.configuration` JVM system property to
18821882
`OVERRIDE`. Alternatively, the default mode may be set via the
1883-
{api-spring-framework}/core/SpringProperties.html[`SpringProperties`] mechanism.
1883+
<<appendix.adoc#appendix-spring-properties,`SpringProperties`>> mechanism.
18841884
=====
18851885

18861886
The <<testcontext-framework>> honors `@NestedTestConfiguration` semantics for the
@@ -4567,7 +4567,7 @@ maximum size is reached, a least recently used (LRU) eviction policy is used to
45674567
close stale contexts. You can configure the maximum size from the command line or a build
45684568
script by setting a JVM system property named `spring.test.context.cache.maxSize`. As an
45694569
alternative, you can set the same property via the
4570-
{api-spring-framework}/core/SpringProperties.html[`SpringProperties`] mechanism.
4570+
<<appendix.adoc#appendix-spring-properties,`SpringProperties`>> mechanism.
45714571

45724572
Since having a large number of application contexts loaded within a given test suite can
45734573
cause the suite to take an unnecessarily long time to run, it is often beneficial to

0 commit comments

Comments
 (0)