diff --git a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java index cef5e337c5b..f6db661d974 100644 --- a/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java +++ b/spring-context/src/main/java/org/springframework/instrument/classloading/jboss/JBossLoadTimeWeaver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2024 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.springframework.instrument.classloading.jboss; import java.lang.instrument.ClassFileTransformer; +import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.lang.reflect.Method; @@ -26,13 +27,14 @@ import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; import org.springframework.util.ReflectionUtils; +import org.springframework.util.function.ThrowingFunction; /** * {@link LoadTimeWeaver} implementation for JBoss's instrumentable ClassLoader. * Thanks to Ales Justin and Marius Bogoevici for the initial prototype. * - *
As of Spring Framework 5.0, this weaver supports WildFly 8+. - * As of Spring Framework 5.1.5, it also supports WildFly 13+. + *
This weaver supports WildFly 13-23 (DelegatingClassFileTransformer) as well as + * WildFly 24+ (DelegatingClassTransformer), as of Spring Framework 6.1.15. * * @author Costin Leau * @author Juergen Hoeller @@ -40,9 +42,15 @@ import org.springframework.util.ReflectionUtils; */ public class JBossLoadTimeWeaver implements LoadTimeWeaver { - private static final String DELEGATING_TRANSFORMER_CLASS_NAME = + private static final String LEGACY_DELEGATING_TRANSFORMER_CLASS_NAME = "org.jboss.as.server.deployment.module.DelegatingClassFileTransformer"; + private static final String DELEGATING_TRANSFORMER_CLASS_NAME = + "org.jboss.as.server.deployment.module.DelegatingClassTransformer"; + + private static final String CLASS_TRANSFORMER_CLASS_NAME = + "org.jboss.modules.ClassTransformer"; + private static final String WRAPPER_TRANSFORMER_CLASS_NAME = "org.jboss.modules.JLIClassTransformer"; @@ -53,6 +61,8 @@ public class JBossLoadTimeWeaver implements LoadTimeWeaver { private final Method addTransformer; + private final ThrowingFunction