Browse Source
Registering a StdConverter with Jackson to log a warning about the Page serialization mode causes the target serializer to be only built for Page losing additional properties defined on extensions. We now instead register a no-op BeanSerializerModifier that issues the warning and doesn't affect the serializer selection. Fixes GH-3137.pull/3142/head
3 changed files with 45 additions and 58 deletions
@ -1,42 +0,0 @@
@@ -1,42 +0,0 @@
|
||||
/* |
||||
* Copyright 2024 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. |
||||
* You may obtain a copy of the License at |
||||
* |
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
* |
||||
* Unless required by applicable law or agreed to in writing, software |
||||
* distributed under the License is distributed on an "AS IS" BASIS, |
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
* See the License for the specific language governing permissions and |
||||
* limitations under the License. |
||||
*/ |
||||
package org.springframework.data.web.config; |
||||
|
||||
import static org.assertj.core.api.Assertions.*; |
||||
|
||||
import org.junit.jupiter.api.Test; |
||||
import org.springframework.data.domain.PageImpl; |
||||
import org.springframework.data.web.config.SpringDataJacksonConfiguration.PageModule; |
||||
import org.springframework.data.web.config.SpringDataJacksonConfiguration.PageModule.WarningMixing; |
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper; |
||||
|
||||
/** |
||||
* Unit tests for {@link SpringDataJacksonConfiguration}. |
||||
* |
||||
* @author Oliver Drotbohm |
||||
*/ |
||||
class SpringDataJacksonConfigurationUnitTests { |
||||
|
||||
@Test // GH-3101
|
||||
void usesDirectRenderingIfNoSpringDataWebSettingsArePresent() { |
||||
|
||||
ObjectMapper mapper = new ObjectMapper(); |
||||
mapper.registerModule(new PageModule(null)); |
||||
|
||||
assertThat(mapper.getSerializationConfig().findMixInClassFor(PageImpl.class)).isEqualTo(WarningMixing.class); |
||||
} |
||||
} |
||||
Loading…
Reference in new issue