Browse Source

DATACMNS-263 - Fixed incompatibility with OpenWebbeans < 1.1.8.

Prefer using non-anonymous inner classes to represent @Default and @Any qualifiers. Upgraded to OpenWebbeans 1.1.7 along the way.
pull/22/head
Oliver Gierke 13 years ago
parent
commit
68ef3c68b0
  1. 2
      spring-data-commons-core/pom.xml
  2. 23
      spring-data-commons-core/src/main/java/org/springframework/data/repository/cdi/CdiRepositoryExtensionSupport.java

2
spring-data-commons-core/pom.xml

@ -19,7 +19,7 @@
<mockito.version>1.8.5</mockito.version> <mockito.version>1.8.5</mockito.version>
<querydsl.version>2.8.0</querydsl.version> <querydsl.version>2.8.0</querydsl.version>
<slf4j.version>1.7.1</slf4j.version> <slf4j.version>1.7.1</slf4j.version>
<webbeans.version>1.1.3</webbeans.version> <webbeans.version>1.1.7</webbeans.version>
</properties> </properties>
<dependencies> <dependencies>

23
spring-data-commons-core/src/main/java/org/springframework/data/repository/cdi/CdiRepositoryExtensionSupport.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2011 the original author or authors. * Copyright 2011-2013 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -94,7 +94,6 @@ public abstract class CdiRepositoryExtensionSupport implements Extension {
/** /**
* Determines the qualifiers of the given type. * Determines the qualifiers of the given type.
*/ */
@SuppressWarnings("serial")
private Set<Annotation> getQualifiers(final Class<?> type) { private Set<Annotation> getQualifiers(final Class<?> type) {
Set<Annotation> qualifiers = new HashSet<Annotation>(); Set<Annotation> qualifiers = new HashSet<Annotation>();
@ -105,14 +104,14 @@ public abstract class CdiRepositoryExtensionSupport implements Extension {
qualifiers.add(annotation); qualifiers.add(annotation);
} }
} }
// Add @Default qualifier if no qualifier is specified. // Add @Default qualifier if no qualifier is specified.
if (qualifiers.isEmpty()) { if (qualifiers.isEmpty()) {
qualifiers.add(new AnnotationLiteral<Default>() { qualifiers.add(DefaultAnnotationLiteral.INSTANCE);
});
} }
// Add @Any qualifier. // Add @Any qualifier.
qualifiers.add(new AnnotationLiteral<Any>() { qualifiers.add(AnyAnnotationLiteral.INSTANCE);
});
return qualifiers; return qualifiers;
} }
@ -124,4 +123,16 @@ public abstract class CdiRepositoryExtensionSupport implements Extension {
protected Iterable<Entry<Class<?>, Set<Annotation>>> getRepositoryTypes() { protected Iterable<Entry<Class<?>, Set<Annotation>>> getRepositoryTypes() {
return repositoryTypes.entrySet(); return repositoryTypes.entrySet();
} }
private static class DefaultAnnotationLiteral extends AnnotationLiteral<Default> implements Default {
private static final long serialVersionUID = 511359421048623933L;
private static final DefaultAnnotationLiteral INSTANCE = new DefaultAnnotationLiteral();
}
private static class AnyAnnotationLiteral extends AnnotationLiteral<Any> implements Any {
private static final long serialVersionUID = 7261821376671361463L;
private static final AnyAnnotationLiteral INSTANCE = new AnyAnnotationLiteral();
}
} }

Loading…
Cancel
Save