Merge pull request #22294 from dreis2211

* gh-22294:
  Reduce started threads in OnClassCondition

Closes gh-22294
This commit is contained in:
Andy Wilkinson
2020-07-14 15:00:23 +01:00

View File

@@ -49,7 +49,7 @@ class OnClassCondition extends FilteringSpringBootCondition {
// Split the work and perform half in a background thread if more than one
// processor is available. Using a single additional thread seems to offer the
// best performance. More threads make things worse.
if (Runtime.getRuntime().availableProcessors() > 1) {
if (autoConfigurationClasses.length > 1 && Runtime.getRuntime().availableProcessors() > 1) {
return resolveOutcomesThreaded(autoConfigurationClasses, autoConfigurationMetadata);
}
else {