Skip to content

Commit 046dedd

Browse files
committed
Fix #5405: Apply property-level JsonFormat overrides for cached serializers
1 parent 18520e9 commit 046dedd

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/main/java/tools/jackson/databind/SerializationContext.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -696,12 +696,9 @@ public ValueSerializer<Object> findPrimaryPropertySerializer(JavaType valueType,
696696
if (ser == null) {
697697
ser = _createAndCachePropertySerializer(valueType, property);
698698
} else if (property != null) {
699-
// [databind#5405]: property-level @JsonFormat overrides must be applied even with cached serializers
700-
JsonFormat.Value overrides = property.findFormatOverrides(_config);
701-
if (overrides != null && !overrides.equals(JsonFormat.Value.empty())) {
702-
BeanDescription.Supplier beanDescRef = lazyIntrospectBeanDescription(valueType);
703-
ser = _checkShapeShifting(valueType, beanDescRef, property, ser);
704-
}
699+
BeanDescription.Supplier beanDescRef = lazyIntrospectBeanDescription(valueType);
700+
// [databind#5405]: property-level @JsonFormat must be honored even with cached serializers
701+
ser = _checkShapeShifting(valueType, beanDescRef, property, ser);
705702
}
706703
return handlePrimaryContextualization(ser, property);
707704
}

0 commit comments

Comments
 (0)