DATACMNS-616 - Fixed field value lookup for private fields in AnnotationDetectionFieldCallback.
We now make the field detected by the callback accessible so that the value lookup doesn't fail for private fields. Added a few more unit tests to verify behavior.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012 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.
|
||||
@@ -23,7 +23,7 @@ import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.ReflectionUtils.FieldCallback;
|
||||
|
||||
/**
|
||||
* A {@link FieldCallback} that will inspect each field for a given annotation. Thie fields type can then be accessed
|
||||
* A {@link FieldCallback} that will inspect each field for a given annotation. This field's type can then be accessed
|
||||
* afterwards.
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
@@ -55,8 +55,11 @@ public class AnnotationDetectionFieldCallback implements FieldCallback {
|
||||
}
|
||||
|
||||
Annotation annotation = field.getAnnotation(annotationType);
|
||||
|
||||
if (annotation != null) {
|
||||
|
||||
this.field = field;
|
||||
ReflectionUtils.makeAccessible(this.field);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user