mirror of
https://github.com/spring-projects/spring-framework.git
synced 2026-10-05 06:29:03 +00:00
Update reference documentation to use Jackson 3
Closes gh-35886
This commit is contained in:
+2
-2
@@ -20,7 +20,7 @@ import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.docs.testing.mockmvc.assertj.mockmvctestersetup.ApplicationWebConfiguration;
|
||||
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter;
|
||||
import org.springframework.http.converter.AbstractJacksonHttpMessageConverter ;
|
||||
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig;
|
||||
import org.springframework.test.web.servlet.assertj.MockMvcTester;
|
||||
import org.springframework.web.context.WebApplicationContext;
|
||||
@@ -34,7 +34,7 @@ class AccountControllerIntegrationTests {
|
||||
|
||||
AccountControllerIntegrationTests(@Autowired WebApplicationContext wac) {
|
||||
this.mockMvc = MockMvcTester.from(wac).withHttpMessageConverters(
|
||||
List.of(wac.getBean(AbstractJackson2HttpMessageConverter.class)));
|
||||
List.of(wac.getBean(AbstractJacksonHttpMessageConverter.class)));
|
||||
}
|
||||
|
||||
// ...
|
||||
|
||||
+2
-2
@@ -21,7 +21,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;
|
||||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
|
||||
import org.springframework.web.servlet.view.json.JacksonJsonView;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
// tag::snippet[]
|
||||
@@ -30,7 +30,7 @@ public class FreeMarkerConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void configureViewResolvers(ViewResolverRegistry registry) {
|
||||
registry.enableContentNegotiation(new MappingJackson2JsonView());
|
||||
registry.enableContentNegotiation(new JacksonJsonView());
|
||||
registry.freeMarker().cache(false);
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -19,7 +19,7 @@ package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigviewresolvers;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView;
|
||||
import org.springframework.web.servlet.view.json.JacksonJsonView;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
// tag::snippet[]
|
||||
@@ -28,7 +28,7 @@ public class WebConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void configureViewResolvers(ViewResolverRegistry registry) {
|
||||
registry.enableContentNegotiation(new MappingJackson2JsonView());
|
||||
registry.enableContentNegotiation(new JacksonJsonView());
|
||||
registry.jsp();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ package org.springframework.docs.testing.mockmvc.assertj.mockmvctestersetup.conv
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired
|
||||
import org.springframework.docs.testing.mockmvc.assertj.mockmvctestersetup.ApplicationWebConfiguration
|
||||
import org.springframework.http.converter.json.AbstractJackson2HttpMessageConverter
|
||||
import org.springframework.http.converter.AbstractJacksonHttpMessageConverter
|
||||
import org.springframework.test.context.junit.jupiter.web.SpringJUnitWebConfig
|
||||
import org.springframework.test.web.servlet.assertj.MockMvcTester
|
||||
import org.springframework.web.context.WebApplicationContext
|
||||
@@ -30,7 +30,7 @@ import org.springframework.web.context.WebApplicationContext
|
||||
class AccountControllerIntegrationTests(@Autowired wac: WebApplicationContext) {
|
||||
|
||||
private val mockMvc = MockMvcTester.from(wac).withHttpMessageConverters(
|
||||
listOf(wac.getBean(AbstractJackson2HttpMessageConverter::class.java)))
|
||||
listOf(wac.getBean(AbstractJacksonHttpMessageConverter::class.java)))
|
||||
|
||||
// ...
|
||||
|
||||
|
||||
+2
-2
@@ -7,14 +7,14 @@ import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
||||
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer
|
||||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView
|
||||
import org.springframework.web.servlet.view.json.JacksonJsonView
|
||||
|
||||
// tag::snippet[]
|
||||
@Configuration
|
||||
class FreeMarkerConfiguration : WebMvcConfigurer {
|
||||
|
||||
override fun configureViewResolvers(registry: ViewResolverRegistry) {
|
||||
registry.enableContentNegotiation(MappingJackson2JsonView())
|
||||
registry.enableContentNegotiation(JacksonJsonView())
|
||||
registry.freeMarker().cache(false)
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -21,13 +21,13 @@ package org.springframework.docs.web.webmvc.mvcconfig.mvcconfigviewresolvers
|
||||
import org.springframework.context.annotation.Configuration
|
||||
import org.springframework.web.servlet.config.annotation.ViewResolverRegistry
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer
|
||||
import org.springframework.web.servlet.view.json.MappingJackson2JsonView
|
||||
import org.springframework.web.servlet.view.json.JacksonJsonView
|
||||
|
||||
// tag::snippet[]
|
||||
@Configuration
|
||||
class WebConfiguration : WebMvcConfigurer {
|
||||
override fun configureViewResolvers(registry: ViewResolverRegistry) {
|
||||
registry.enableContentNegotiation(MappingJackson2JsonView())
|
||||
registry.enableContentNegotiation(JacksonJsonView())
|
||||
registry.jsp()
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
<mvc:view-resolvers>
|
||||
<mvc:content-negotiation>
|
||||
<mvc:default-views>
|
||||
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/>
|
||||
<bean class="org.springframework.web.servlet.view.json.JacksonJsonView"/>
|
||||
</mvc:default-views>
|
||||
</mvc:content-negotiation>
|
||||
<mvc:freemarker cache-views="false"/>
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
<mvc:view-resolvers>
|
||||
<mvc:content-negotiation>
|
||||
<mvc:default-views>
|
||||
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView"/>
|
||||
<bean class="org.springframework.web.servlet.view.json.JacksonJsonView"/>
|
||||
</mvc:default-views>
|
||||
</mvc:content-negotiation>
|
||||
<mvc:jsp/>
|
||||
|
||||
Reference in New Issue
Block a user