Mark XML-configured executor/scheduler as infrastructure bean

Closes gh-34015
This commit is contained in:
Juergen Hoeller 2025-02-18 13:13:34 +01:00
parent e230ea537c
commit d0ceefedc6
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2024 the original author or authors. * Copyright 2002-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package org.springframework.scheduling.config;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.RootBeanDefinition; import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
@ -53,6 +54,7 @@ public class ExecutorBeanDefinitionParser extends AbstractSingleBeanDefinitionPa
if (StringUtils.hasText(poolSize)) { if (StringUtils.hasText(poolSize)) {
builder.addPropertyValue("poolSize", poolSize); builder.addPropertyValue("poolSize", poolSize);
} }
builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
} }
private void configureRejectionPolicy(Element element, BeanDefinitionBuilder builder) { private void configureRejectionPolicy(Element element, BeanDefinitionBuilder builder) {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2025 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -18,6 +18,7 @@ package org.springframework.scheduling.config;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser; import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
@ -41,6 +42,7 @@ public class SchedulerBeanDefinitionParser extends AbstractSingleBeanDefinitionP
if (StringUtils.hasText(poolSize)) { if (StringUtils.hasText(poolSize)) {
builder.addPropertyValue("poolSize", poolSize); builder.addPropertyValue("poolSize", poolSize);
} }
builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
} }
} }