Skip to content

Commit 4862819

Browse files
committed
Apply fallback in case of any exception coming out of createClass
Closes gh-34423 (cherry picked from commit 93134fd)
1 parent 3cf1fbf commit 4862819

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ private Class<?> createClass(Enhancer enhancer, boolean fallback) {
168168
try {
169169
subclass = enhancer.createClass();
170170
}
171-
catch (CodeGenerationException ex) {
171+
catch (Throwable ex) {
172172
if (!fallback) {
173-
throw ex;
173+
throw (ex instanceof CodeGenerationException cgex ? cgex : new CodeGenerationException(ex));
174174
}
175175
// Possibly a package-visible @Bean method declaration not accessible
176176
// in the given ClassLoader -> retry with original ClassLoader

0 commit comments

Comments
 (0)