Skip to content

Commit 4c31386

Browse files
committed
fix the npe issue when is annotated on methods
1 parent 5df2056 commit 4c31386

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

apollo-client/src/main/java/com/ctrip/framework/apollo/spring/property/AutoUpdateConfigChangeListener.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,9 @@ private Object resolvePropertyValue(SpringValue springValue) {
113113
.resolvePropertyValue(beanFactory, springValue.getBeanName(), springValue.getPlaceholder());
114114

115115
if (springValue.isJson()) {
116-
ApolloJsonValue apolloJsonValue = springValue.getField().getAnnotation(ApolloJsonValue.class);
116+
ApolloJsonValue apolloJsonValue = springValue.isField() ?
117+
springValue.getField().getAnnotation(ApolloJsonValue.class) :
118+
springValue.getMethodParameter().getMethodAnnotation(ApolloJsonValue.class);
117119
String datePattern = apolloJsonValue != null ? apolloJsonValue.datePattern() : StringUtils.EMPTY;
118120
value = parseJsonValue((String) value, springValue.getGenericType(), datePattern);
119121
} else {

0 commit comments

Comments
 (0)