Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -120,7 +120,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Set<Class<? extends Annotation>> autowiredAnnotationTypes =
|
||||
new LinkedHashSet<Class<? extends Annotation>>();
|
||||
new LinkedHashSet<Class<? extends Annotation>>(4);
|
||||
|
||||
private String requiredParameterName = "required";
|
||||
|
||||
@@ -484,7 +484,7 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
}
|
||||
|
||||
private AnnotationAttributes findAutowiredAnnotation(AccessibleObject ao) {
|
||||
if (ao.getAnnotations().length > 0) {
|
||||
if (ao.getAnnotations().length > 0) { // autowiring annotations have to be local
|
||||
for (Class<? extends Annotation> type : this.autowiredAnnotationTypes) {
|
||||
AnnotationAttributes attributes = AnnotatedElementUtils.getMergedAnnotationAttributes(ao, type);
|
||||
if (attributes != null) {
|
||||
@@ -594,11 +594,10 @@ public class AutowiredAnnotationBeanPostProcessor extends InstantiationAwareBean
|
||||
registerDependentBeans(beanName, autowiredBeanNames);
|
||||
if (autowiredBeanNames.size() == 1) {
|
||||
String autowiredBeanName = autowiredBeanNames.iterator().next();
|
||||
if (beanFactory.containsBean(autowiredBeanName)) {
|
||||
if (beanFactory.isTypeMatch(autowiredBeanName, field.getType())) {
|
||||
this.cachedFieldValue = new ShortcutDependencyDescriptor(
|
||||
desc, autowiredBeanName, field.getType());
|
||||
}
|
||||
if (beanFactory.containsBean(autowiredBeanName) &&
|
||||
beanFactory.isTypeMatch(autowiredBeanName, field.getType())) {
|
||||
this.cachedFieldValue = new ShortcutDependencyDescriptor(
|
||||
desc, autowiredBeanName, field.getType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -342,10 +342,12 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa
|
||||
* Determine a suggested value from any of the given candidate annotations.
|
||||
*/
|
||||
protected Object findValue(Annotation[] annotationsToSearch) {
|
||||
AnnotationAttributes attr = AnnotatedElementUtils.getMergedAnnotationAttributes(
|
||||
AnnotatedElementUtils.forAnnotations(annotationsToSearch), this.valueAnnotationType);
|
||||
if (attr != null) {
|
||||
return extractValue(attr);
|
||||
if (annotationsToSearch.length > 0) { // qualifier annotations have to be local
|
||||
AnnotationAttributes attr = AnnotatedElementUtils.getMergedAnnotationAttributes(
|
||||
AnnotatedElementUtils.forAnnotations(annotationsToSearch), this.valueAnnotationType);
|
||||
if (attr != null) {
|
||||
return extractValue(attr);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2018 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.
|
||||
@@ -52,13 +52,13 @@ public class AnnotationCacheOperationSourceTests {
|
||||
|
||||
|
||||
@Test
|
||||
public void singularAnnotation() throws Exception {
|
||||
public void singularAnnotation() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "singular", 1);
|
||||
assertTrue(ops.iterator().next() instanceof CacheableOperation);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleAnnotation() throws Exception {
|
||||
public void multipleAnnotation() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multiple", 2);
|
||||
Iterator<CacheOperation> it = ops.iterator();
|
||||
assertTrue(it.next() instanceof CacheableOperation);
|
||||
@@ -66,7 +66,7 @@ public class AnnotationCacheOperationSourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void caching() throws Exception {
|
||||
public void caching() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "caching", 2);
|
||||
Iterator<CacheOperation> it = ops.iterator();
|
||||
assertTrue(it.next() instanceof CacheableOperation);
|
||||
@@ -74,18 +74,18 @@ public class AnnotationCacheOperationSourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyCaching() throws Exception {
|
||||
public void emptyCaching() {
|
||||
getOps(AnnotatedClass.class, "emptyCaching", 0);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singularStereotype() throws Exception {
|
||||
public void singularStereotype() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "singleStereotype", 1);
|
||||
assertTrue(ops.iterator().next() instanceof CacheEvictOperation);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleStereotypes() throws Exception {
|
||||
public void multipleStereotypes() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleStereotype", 3);
|
||||
Iterator<CacheOperation> it = ops.iterator();
|
||||
assertTrue(it.next() instanceof CacheableOperation);
|
||||
@@ -98,7 +98,7 @@ public class AnnotationCacheOperationSourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleComposedAnnotation() throws Exception {
|
||||
public void singleComposedAnnotation() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "singleComposed", 2);
|
||||
Iterator<CacheOperation> it = ops.iterator();
|
||||
|
||||
@@ -114,7 +114,7 @@ public class AnnotationCacheOperationSourceTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleComposedAnnotations() throws Exception {
|
||||
public void multipleComposedAnnotations() {
|
||||
Collection<CacheOperation> ops = getOps(AnnotatedClass.class, "multipleComposed", 4);
|
||||
Iterator<CacheOperation> it = ops.iterator();
|
||||
|
||||
|
||||
@@ -1712,7 +1712,7 @@ for more configuration examples.
|
||||
|
||||
The `MarshallingView` uses an XML `Marshaller` defined in the `org.springframework.oxm`
|
||||
package to render the response content as XML. The object to be marshalled can be set
|
||||
explicitly using ``MarhsallingView``'s `modelKey` bean property. Alternatively, the view
|
||||
explicitly using ``MarshallingView``'s `modelKey` bean property. Alternatively, the view
|
||||
will iterate over all model properties and marshal the first type that is supported
|
||||
by the `Marshaller`. For more information on the functionality in the
|
||||
`org.springframework.oxm` package refer to the chapter <<oxm,Marshalling XML using O/X
|
||||
|
||||
Reference in New Issue
Block a user