Appendix

本部分参考文档涵盖了适用于核心 Spring 框架中多个模块的主题。

This part of the reference documentation covers topics that apply to multiple modules within the core Spring Framework.

Spring Properties

SpringProperties 是一个用于控制 Spring Framework 某些底层方面的属性的静态持有器。可以通过 JVM 系统属性或通过 `SpringProperties.setProperty(String key, String value)`方法以编程方式,让用户配置这些属性。如果部署环境不允许自定义 JVM 系统属性,后者可能是必需的。或者,这些属性可以配置在类路径根目录的 `spring.properties`文件中,例如部署在应用程序的 JAR 文件中。

SpringProperties is a static holder for properties that control certain low-level aspects of the Spring Framework. Users can configure these properties via JVM system properties or programmatically via the SpringProperties.setProperty(String key, String value) method. The latter may be necessary if the deployment environment disallows custom JVM system properties. As an alternative, these properties may be configured in a spring.properties file in the root of the classpath — for example, deployed within the application’s JAR file.

下表列出所有当前受支持的 Spring 属性。

The following table lists all currently supported Spring properties.

Table 1. Supported Spring Properties
Name Description

spring.aot.enabled

Indicates the application should run with AOT generated artifacts. See Ahead of Time Optimizations and AotDetector for details.

spring.beaninfo.ignore

Instructs Spring to use the Introspector.IGNORE_ALL_BEANINFO mode when calling the JavaBeans Introspector. See CachedIntrospectionResults for details.

spring.cache.reactivestreams.ignore

Instructs Spring’s caching infrastructure to ignore the presence of Reactive Streams, in particular Reactor’s Mono/Flux in @Cacheable method return type declarations. See CacheAspectSupport for details.

spring.classformat.ignore

Instructs Spring to ignore class format exceptions during classpath scanning, in particular for unsupported class file versions. See ClassPathScanningCandidateComponentProvider for details.

spring.context.checkpoint

Property that specifies a common context checkpoint. See Automatic checkpoint/restore at startup and DefaultLifecycleProcessor for details.

spring.context.exit

Property for terminating the JVM when the context reaches a specific phase. See Automatic checkpoint/restore at startup and DefaultLifecycleProcessor for details.

spring.context.expression.maxLength

The maximum length for Spring Expression Language expressions used in XML bean definitions, @Value, etc.

spring.expression.compiler.mode

The mode to use when compiling expressions for the Spring Expression Language.

spring.getenv.ignore

Instructs Spring to ignore operating system environment variables if a Spring Environment property — for example, a placeholder in a configuration String — isn’t resolvable otherwise. See AbstractEnvironment for details.

spring.jdbc.getParameterType.ignore

Instructs Spring to ignore java.sql.ParameterMetaData.getParameterType completely. See the note in Batch Operations with a List of Objects.

spring.jndi.ignore

Instructs Spring to ignore a default JNDI environment, as an optimization for scenarios where nothing is ever to be found for such JNDI fallback searches to begin with, avoiding the repeated JNDI lookup overhead. See JndiLocatorDelegate for details.

spring.objenesis.ignore

Instructs Spring to ignore Objenesis, not even attempting to use it. See SpringObjenesis for details.

spring.test.aot.processing.failOnError

A boolean flag that controls whether errors encountered during AOT processing in the Spring TestContext Framework should result in an exception that fails the overall process. See Ahead of Time Support for Tests.

spring.test.constructor.autowire.mode

The default test constructor autowire mode to use if @TestConstructor is not present on a test class. See Changing the default test constructor autowire mode.

spring.test.context.cache.maxSize

The maximum size of the context cache in the Spring TestContext Framework. See Context Caching.

spring.test.context.failure.threshold

The failure threshold for errors encountered while attempting to load an ApplicationContext in the Spring TestContext Framework. See Context Failure Threshold.

spring.test.enclosing.configuration

The default enclosing configuration inheritance mode to use if @NestedTestConfiguration is not present on a test class. See Changing the default enclosing configuration inheritance mode.