Global Properties
可以通过提供类路径上的属性文件来覆盖某些全局框架属性。
Certain global framework properties can be overridden by providing a properties file on the classpath.
默认属性可以在 org.springframework.integration.context.IntegrationProperties
类中找到。以下列表显示了默认值:
The default properties can be found in org.springframework.integration.context.IntegrationProperties
class.
The following listing shows the default values:
spring.integration.channels.autoCreate=true 1
spring.integration.channels.maxUnicastSubscribers=0x7fffffff 2
spring.integration.channels.maxBroadcastSubscribers=0x7fffffff 3
spring.integration.taskScheduler.poolSize=10 4
spring.integration.messagingTemplate.throwExceptionOnLateReply=false 5
spring.integration.readOnly.headers= 6
spring.integration.endpoints.noAutoStartup= 7
spring.integration.channels.error.requireSubscribers=true 8
spring.integration.channels.error.ignoreFailures=true 9
spring.integration.endpoints.defaultTimeout=30000 10
1 | 当为 true 时,当在应用程序上下文中找不到时,input-channel 实例会自动声明为 DirectChannel 实例。 |
2 | When true, input-channel instances are automatically declared as DirectChannel instances when not explicitly found in the application context. |
3 | 设置允许在 DirectChannel 上的默认订阅者数量。可用于避免无意中将多端点订阅到同一频道。可以通过设置 max-subscribers 特性在各个频道上覆盖它。 |
4 | Sets the default number of subscribers allowed on, for example, a DirectChannel .
It can be used to avoid inadvertently subscribing multiple endpoints to the same channel.
You can override it on individual channels by setting the max-subscribers attribute. |
5 | 此属性提供了允许在 PublishSubscribeChannel 上的默认订阅者数量。可用于避免无意中订阅多于预期数目的端点到同一频道。可以通过设置 max-subscribers 特性在各个频道上覆盖它。 |
6 | This property provides the default number of subscribers allowed on, for example, a PublishSubscribeChannel .
It can be used to avoid inadvertently subscribing more than the expected number of endpoints to the same channel.
You can override it on individual channels by setting the max-subscribers attribute. |
7 | 在默认 taskScheduler bean 中可用的线程数。参见 Configuring the Task Scheduler。 |
8 | The number of threads available in the default taskScheduler bean.
See Configuring the Task Scheduler. |
9 | 当 true 时,当网关未预期回复时(因为发送线程已超时或已收到回复),传送到网关回复频道的消息会引发异常。 |
10 | When true , messages that arrive at a gateway reply channel throw an exception when the gateway is not expecting a reply (because the sending thread has timed out or already received a reply). |
11 | 在一个标头复制操作期间不应填充到 Message 实例中的消息标头名称的逗号分隔列表。该列表由 DefaultMessageBuilderFactory bean 使用,并传播到用于通过 MessageBuilder 构建消息的 IntegrationMessageHeaderAccessor 实例(参见 The MessageBuilder Helper Class)。默认情况下,在消息构建期间仅 MessageHeaders.ID 和 MessageHeaders.TIMESTAMP 不被复制。自 4.3.2 版本起。 |
12 | A comma-separated list of message header names that should not be populated into Message instances during a header copying operation.
The list is used by the DefaultMessageBuilderFactory bean and propagated to the IntegrationMessageHeaderAccessor instances (see MessageHeaderAccessor API) used to build messages via MessageBuilder (see The MessageBuilder Helper Class).
By default, only MessageHeaders.ID and MessageHeaders.TIMESTAMP are not copied during message building.
Since version 4.3.2. |
13 | 不应该在应用程序启动期间自动启动的 AbstractEndpoint bean 名称模式(xxx* 、xxx , *xxx 或 xxx*yyy )的逗号分隔列表。你可以通过 bean 名称通过 Control Bus 手动启动这些端点(参见 Control Bus),通过带有 SmartLifecycleRoleController 的角色(参见 Endpoint Roles),或通过 Lifecycle bean 注入。通过指定 auto-startup XML 注解或 autoStartup 注解特性或在 bean 定义中调用 AbstractEndpoint.setAutoStartup() ,你可以明确覆盖此全局属性的效果。自 4.3.12 版本起。 |
14 | A comma-separated list of AbstractEndpoint bean names patterns (xxx* , xxx , *xxx or xxx*yyy ) that should not be started automatically during application startup.
You can manually start these endpoints later by their bean name through a Control Bus (see Control Bus), by their role with the SmartLifecycleRoleController (see Endpoint Roles), or by Lifecycle bean injection.
You can explicitly override the effect of this global property by specifying auto-startup XML annotation or the autoStartup annotation attribute or by calling AbstractEndpoint.setAutoStartup() in the bean definition.
Since version 4.3.12. |
15 | 一个布尔标记,表示必须配置带有 errorChannel 选项的默认全局 requireSubscribers 。自 5.4.3 版本起。更多详细信息,参见 Error Handling。 |
16 | A boolean flag to indicate that default global errorChannel must be configured with the requireSubscribers option.
Since version 5.4.3.
See Error Handling for more information. |
17 | 一个布尔标记,表示默认全局 errorChannel 必须忽略分派错误,并向下一个处理程序传递消息。自 5.5 版本起。 |
18 | A boolean flag to indicate that default global errorChannel must ignore dispatching errors and pass the message to the next handler.
Since version 5.5. |
19 | 端点中请求和回复超时的默认毫秒数。默认值为 30 秒,以避免无限期阻塞。可以配置为负值以恢复端点中的无限阻塞行为。自 6.2 版本起。 |
20 | The default number of milliseconds for request and reply timeouts in endpoints. Default value is 30 seconds to avoid indefinite blocking. Can be configured to a negative value to restore infinite blocking behavior in endpoints. Since version 6.2. |
可以通过向类路径添加 /META-INF/spring.integration.properties
文件或 IntegrationContextUtils.INTEGRATION_GLOBAL_PROPERTIES_BEAN_NAME
bean 来覆盖这些属性,以获取 org.springframework.integration.context.IntegrationProperties
实例。您不必提供所有属性,只需要您想要覆盖的属性即可。
These properties can be overridden by adding a /META-INF/spring.integration.properties
file to the classpath or an IntegrationContextUtils.INTEGRATION_GLOBAL_PROPERTIES_BEAN_NAME
bean for the org.springframework.integration.context.IntegrationProperties
instance.
You need not provide all the properties — only those that you want to override.
从版本 5.1 开始,当为 org.springframework.integration
类别启用 DEBUG
逻辑级别时,在应用程序上下文启动后,所有合并的全局属性都会打印在日志中。输出如下所示:
Starting with version 5.1, all the merged global properties are printed in the logs after application context startup when a DEBUG
logic level is turned on for the org.springframework.integration
category.
The output looks like this:
Spring Integration global properties:
spring.integration.endpoints.noAutoStartup=fooService*
spring.integration.taskScheduler.poolSize=20
spring.integration.channels.maxUnicastSubscribers=0x7fffffff
spring.integration.channels.autoCreate=true
spring.integration.channels.maxBroadcastSubscribers=0x7fffffff
spring.integration.readOnly.headers=
spring.integration.messagingTemplate.throwExceptionOnLateReply=true
spring.integration.endpoints.defaultTimeout=-1