public class BroadleafRestApiMvcConfiguration
extends org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
Default Broadleaf-recommended configuration for REST APIs. Recommended use is to extend this class and annotate
your extension with @Configuration
and @EnableWebMvc
The child class must also be added as the contextConfigLocation
for a new DispatcherServlet
servlet with contextClass
AnnotationConfigWebApplicationContext
in web.xml.
Modifier and Type | Field and Description |
---|---|
protected WrapperOverrideTypeModifier |
typeModifier |
Constructor and Description |
---|
BroadleafRestApiMvcConfiguration() |
Modifier and Type | Method and Description |
---|---|
void |
configureContentNegotiation(org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer configurer)
Setup a simple strategy: use all the defaults and return JSON by default when not sure.
|
void |
configureMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> converters) |
protected org.springframework.http.converter.HttpMessageConverter<?> |
getJsonConverter() |
protected com.fasterxml.jackson.databind.ObjectMapper |
getObjectMapper(boolean useXml) |
protected org.springframework.http.converter.json.Jackson2ObjectMapperBuilder |
getObjectMapperBuilder() |
protected org.springframework.http.converter.HttpMessageConverter<?> |
getXmlConverter()
Subclasses might override this method to use JAXB natively for XML serialization by
return new Jaxb2RootElementHttpMessageConverter() |
addArgumentResolvers, addFormatters, addInterceptors, addResourceHandlers, addReturnValueHandlers, addViewControllers, configureAsyncSupport, configureDefaultServletHandling, configureHandlerExceptionResolvers, configurePathMatch, configureViewResolvers, extendMessageConverters, getMessageCodesResolver, getValidator
protected WrapperOverrideTypeModifier typeModifier
public void configureMessageConverters(List<org.springframework.http.converter.HttpMessageConverter<?>> converters)
configureMessageConverters
in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
configureMessageConverters
in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
public void configureContentNegotiation(org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer configurer)
configureContentNegotiation
in interface org.springframework.web.servlet.config.annotation.WebMvcConfigurer
configureContentNegotiation
in class org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
protected org.springframework.http.converter.HttpMessageConverter<?> getJsonConverter()
protected org.springframework.http.converter.HttpMessageConverter<?> getXmlConverter()
return new Jaxb2RootElementHttpMessageConverter()
#getObjectMapper(boolean)}
protected com.fasterxml.jackson.databind.ObjectMapper getObjectMapper(boolean useXml)
protected org.springframework.http.converter.json.Jackson2ObjectMapperBuilder getObjectMapperBuilder()
Copyright © 2017. All rights reserved.