Skip to content

Commit c1dbb02

Browse files
artembilangaryrussell
authored andcommitted
GH-3875: Initialize ClassUtils as early as possible
Fixes #3875 The class `static` variables and initialization block are performed on first class access. * Add "fake" `ClassUtils.resolvePrimitiveType(Integer.class)` call to the `IntegrationRegistrar` to trigger `ClassUtils` initialization with the current Spring `ClassLoader` **Cherry-pick to `5.5.x`**
1 parent abce38c commit c1dbb02

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

spring-integration-core/src/main/java/org/springframework/integration/config/IntegrationRegistrar.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2021 the original author or authors.
2+
* Copyright 2014-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -56,6 +56,9 @@ public class IntegrationRegistrar implements ImportBeanDefinitionRegistrar {
5656
public void registerBeanDefinitions(@Nullable AnnotationMetadata importingClassMetadata,
5757
BeanDefinitionRegistry registry) {
5858

59+
// Ensure that ClassUtils is initialized with a proper Spring application context ClassLoader.
60+
org.springframework.integration.util.ClassUtils.resolvePrimitiveType(Integer.class);
61+
5962
registerDefaultConfiguringBeanFactoryPostProcessor(registry);
6063
registerIntegrationConfigurationBeanFactoryPostProcessor(registry);
6164
if (importingClassMetadata != null) {

0 commit comments

Comments
 (0)