Skip to content
This repository was archived by the owner on Feb 23, 2023. It is now read-only.

Commit 882d78d

Browse files
committed
Only register default constructor for TELs for reflection in native image
See gh-1217
1 parent 95b450a commit 882d78d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

spring-aot/src/main/java/org/springframework/aot/factories/TestExecutionListenerFactoriesCodeContributor.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import org.springframework.aot.build.context.BuildContext;
2222
import org.springframework.nativex.domain.reflect.ClassDescriptor;
23-
import org.springframework.nativex.hint.Flag;
23+
import org.springframework.nativex.domain.reflect.MethodDescriptor;
2424

2525
/**
2626
* {@link FactoriesCodeContributor} that contributes source code for
@@ -52,10 +52,10 @@ public void contribute(SpringFactory factory, CodeGenerator code, BuildContext c
5252
}
5353

5454
private void generateReflectionMetadata(SpringFactory factory, BuildContext context) {
55-
String factoryClassName = factory.getFactory().getClassName();
56-
ClassDescriptor factoryDescriptor = ClassDescriptor.of(factoryClassName);
57-
factoryDescriptor.setFlag(Flag.allDeclaredConstructors);
58-
context.describeReflection(reflect -> reflect.add(factoryDescriptor));
55+
String className = factory.getFactory().getClassName();
56+
ClassDescriptor classDescriptor = ClassDescriptor.of(className);
57+
classDescriptor.addMethodDescriptor(MethodDescriptor.of(MethodDescriptor.CONSTRUCTOR_NAME, (String[]) null));
58+
context.describeReflection(reflect -> reflect.add(classDescriptor));
5959
}
6060

6161
}

0 commit comments

Comments
 (0)