From 470e9c8558e689e84d0fcb120b2d62c026f60788 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Fri, 25 Apr 2014 23:39:50 +0200 Subject: [PATCH] Configuration class processing explicitly skips java.* classes since we'll never find @Bean annotations there anyway Issue: SPR-11718 --- .../annotation/ConfigurationClassParser.java | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java index 42bc493c1f1..611ceff6d17 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 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. @@ -224,23 +224,13 @@ class ConfigurationClassParser { // process superclass, if any if (metadata.hasSuperClass()) { String superclass = metadata.getSuperClassName(); - if (!this.knownSuperclasses.containsKey(superclass)) { + if (!superclass.startsWith("java") && !this.knownSuperclasses.containsKey(superclass)) { this.knownSuperclasses.put(superclass, configClass); // superclass found, return its annotation metadata and recurse if (metadata instanceof StandardAnnotationMetadata) { Class clazz = ((StandardAnnotationMetadata) metadata).getIntrospectedClass(); return new StandardAnnotationMetadata(clazz.getSuperclass(), true); } - else if (superclass.startsWith("java")) { - // never load core JDK classes via ASM, in particular not java.lang.Object! - try { - return new StandardAnnotationMetadata( - this.resourceLoader.getClassLoader().loadClass(superclass), true); - } - catch (ClassNotFoundException ex) { - throw new IllegalStateException(ex); - } - } else { MetadataReader reader = this.metadataReaderFactory.getMetadataReader(superclass); return reader.getAnnotationMetadata();