Adapt to renamed properties by using MappedProperties in association deserialization.

Revert the changes that employed manual annotation lookup as that would cause invalid associations of fields and accessor methods for properties shadow renamed. Instead, we now use MappedProperties that already contains a mapping between the Jackson field names and Sprign Data property names.

Fixes: #2165
This commit is contained in:
Oliver Drotbohm
2023-02-21 13:24:39 +01:00
parent 5335fe61e9
commit b65e0c9118
3 changed files with 8 additions and 23 deletions

View File

@@ -19,7 +19,6 @@ import static org.assertj.core.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import lombok.AccessLevel;
import lombok.Data;
import lombok.Getter;
@@ -190,10 +189,9 @@ class PersistentEntityJackson2ModuleUnitTests {
PetOwner petOwner = mapper.readValue("{\"package\":\"/packages/1\"}", PetOwner.class);
assertThat(petOwner).isNotNull();
assertThat(petOwner.getPackage()).isNotNull();
assertThat(petOwner._package).isNotNull();
}
@Test // DATAREST-1321
void allowsNumericIdsForLookupTypes() throws Exception {
@@ -298,12 +296,7 @@ class PersistentEntityJackson2ModuleUnitTests {
Pet pet;
Home home;
@Getter(value = AccessLevel.NONE)
@JsonProperty("package") Package _package;
public Package getPackage() {
return _package;
}
}
static class Package {}