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

附录

本部分参考文档涵盖适用于核心 Spring 框架中多个模块的主题。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属性
名称 描述

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

指示 Spring 在调用 JavaBeans Introspector.IGNORE_ALL_BEANINFO 时使用 Introspector 模式。有关详细信息,请参阅 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查找开销。请参阅 JndiLocatorDelegate 了解详细信息。spring-doc.cadn.net.cn

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

指示 Spring 忽略 Objenesis,甚至不尝试使用它。请参阅 SpringObjenesis 了解详细信息。spring-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 Framework 中。请参阅 上下文缓存spring-doc.cadn.net.cn

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

默认的 封闭配置继承模式,如果测试类上没有 @NestedTestConfiguration,则使用此模式。请参阅 更改默认的封闭配置继承模式spring-doc.cadn.net.cn