properly scan subpackages as well (SPR-5324)

This commit is contained in:
Juergen Hoeller
2008-11-28 14:05:15 +00:00
parent 4f40a6c313
commit 71df72d634

View File

@@ -17,7 +17,6 @@
package org.springframework.orm.hibernate3.annotation;
import java.io.IOException;
import javax.persistence.Embeddable;
import javax.persistence.Entity;
import javax.persistence.MappedSuperclass;
@@ -78,7 +77,7 @@ import org.springframework.util.ClassUtils;
*/
public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implements ResourceLoaderAware {
private static final String RESOURCE_PATTERN = "**/*.class";
private static final String RESOURCE_PATTERN = "/**/*.class";
private Class[] annotatedClasses;
@@ -164,13 +163,13 @@ public class AnnotationSessionFactoryBean extends LocalSessionFactoryBean implem
protected void postProcessMappings(Configuration config) throws HibernateException {
AnnotationConfiguration annConfig = (AnnotationConfiguration) config;
if (this.annotatedClasses != null) {
for (int i = 0; i < this.annotatedClasses.length; i++) {
annConfig.addAnnotatedClass(this.annotatedClasses[i]);
for (Class annotatedClass : this.annotatedClasses) {
annConfig.addAnnotatedClass(annotatedClass);
}
}
if (this.annotatedPackages != null) {
for (int i = 0; i < this.annotatedPackages.length; i++) {
annConfig.addPackage(this.annotatedPackages[i]);
for (String annotatedPackage : this.annotatedPackages) {
annConfig.addPackage(annotatedPackage);
}
}
scanPackages(annConfig);