diff --git a/src/main/java/org/springframework/data/repository/config/RepositoryComponentProvider.java b/src/main/java/org/springframework/data/repository/config/RepositoryComponentProvider.java index 81500c57e..5e386d271 100644 --- a/src/main/java/org/springframework/data/repository/config/RepositoryComponentProvider.java +++ b/src/main/java/org/springframework/data/repository/config/RepositoryComponentProvider.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2013 the original author or authors. + * Copyright 2012-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. @@ -44,6 +44,8 @@ import org.springframework.util.Assert; */ class RepositoryComponentProvider extends ClassPathScanningCandidateComponentProvider { + private static final String METHOD_NOT_PUBLIC = "AnnotationConfigUtils.processCommonDefinitionAnnotations(…) is not public! Make sure you're using Spring 3.2.5 or better. The class was loaded from %s."; + private boolean considerNestedRepositoryInterfaces; /** @@ -57,6 +59,8 @@ class RepositoryComponentProvider extends ClassPathScanningCandidateComponentPro super(false); + assertRequiredSpringVersionPresent(); + Assert.notNull(includeFilters); if (includeFilters.iterator().hasNext()) { @@ -142,6 +146,20 @@ class RepositoryComponentProvider extends ClassPathScanningCandidateComponentPro this.considerNestedRepositoryInterfaces = considerNestedRepositoryInterfaces; } + /** + * Makes sure {@link AnnotationConfigUtils#processCommonDefinitionAnnotations(AnnotatedBeanDefinition) is public and + * indicates the offending JAR if not. + */ + private static void assertRequiredSpringVersionPresent() { + + try { + AnnotationConfigUtils.class.getMethod("processCommonDefinitionAnnotations", AnnotatedBeanDefinition.class); + } catch (NoSuchMethodException o_O) { + throw new IllegalStateException(String.format(METHOD_NOT_PUBLIC, AnnotationConfigUtils.class + .getProtectionDomain().getCodeSource().getLocation()), o_O); + } + } + /** * {@link org.springframework.core.type.filter.TypeFilter} that only matches interfaces. Thus setting this up makes * only sense providing an interface type as {@code targetType}.