对于最新稳定版本,请使用 Spring Framework 7.0.6spring-doc.cadn.net.cn

附录

本参考文档的这一部分涵盖了适用于 Spring Framework 核心中多个模块的主题。spring-doc.cadn.net.cn

Spring 属性

SpringProperties 是一个静态持有者, 用于控制 Spring 框架某些底层方面的属性。用户可以通过 JVM 系统属性或通过编程方式调用 SpringProperties.setProperty(String key, String value) 方法来配置这些属性。如果部署环境不允许自定义 JVM 系统属性,则可能需要使用后者。 作为替代方案,这些属性也可以在类路径根目录下的 spring.properties 文件中进行配置——例如,部署在应用程序的 JAR 文件中。spring-doc.cadn.net.cn

下表列出了所有当前支持的 Spring 属性。spring-doc.cadn.net.cn

表1. 支持的Spring属性
姓名 <description> </description>

spring.beaninfo.ignorespring-doc.cadn.net.cn

指示 Spring 在调用 JavaBeans Introspector 时使用 Introspector.IGNORE_ALL_BEANINFO 模式。详见 CachedIntrospectionResultsspring-doc.cadn.net.cn

spring.expression.compiler.modespring-doc.cadn.net.cn

编译表达式时用于Spring 表达式语言的模式。spring-doc.cadn.net.cn

spring.getenv.ignorespring-doc.cadn.net.cn

指示 Spring 忽略操作系统环境变量,如果某个 Spring Environment 属性(例如配置字符串中的占位符)无法通过其他方式解析。请参阅 AbstractEnvironment 以获取详细信息。spring-doc.cadn.net.cn

spring.index.ignorespring-doc.cadn.net.cn

指示 Spring 忽略位于 META-INF/spring.components 中的组件索引。参见生成候选组件索引spring-doc.cadn.net.cn

spring.jdbc.getParameterType.ignorespring-doc.cadn.net.cn

指示 Spring 完全忽略 java.sql.ParameterMetaData.getParameterType。 参见使用对象列表进行批处理操作中的说明。spring-doc.cadn.net.cn

spring.jndi.ignorespring-doc.cadn.net.cn

指示 Spring 忽略默认的 JNDI 环境,作为一种优化措施,适用于根本不会在此类 JNDI 回退搜索中找到任何内容的场景,从而避免重复的 JNDI 查找开销。详情请参见 JndiLocatorDelegatespring-doc.cadn.net.cn

spring.objenesis.ignorespring-doc.cadn.net.cn

指示 Spring 忽略 Objenesis,甚至不尝试使用它。详情请参见 SpringObjenesisspring-doc.cadn.net.cn

spring.test.constructor.autowire.modespring-doc.cadn.net.cn

如果测试类上未指定 @TestConstructor 注解,则使用默认的测试构造函数自动装配模式。参见更改默认的测试构造函数自动装配模式spring-doc.cadn.net.cn

spring.test.context.cache.maxSizespring-doc.cadn.net.cn

Spring TestContext 框架中上下文缓存的最大大小。参见上下文缓存spring-doc.cadn.net.cn

spring.test.enclosing.configurationspring-doc.cadn.net.cn

如果测试类上未指定 @NestedTestConfiguration,则使用默认的封闭配置继承模式。参见 更改默认的封闭配置继承模式spring-doc.cadn.net.cn