@Configuration public class RestConfig extends Object implements org.springframework.beans.factory.config.BeanFactoryPostProcessor
Configuration
that adds a MappingJackson2HttpMessageConverter
and an ObjectMapper
to the
context, if not already present. Module
s and adds them to the ObjectMapper
.Temporal
-types are registered:
OffsetDateTime
, using DateTimeFormatter.ISO_OFFSET_DATE_TIME
LocalDate
, using DateTimeFormatter.ISO_LOCAL_DATE
LocalTime
, using DateTimeFormatter.ISO_LOCAL_TIME
LocalDateTime
, using DateTimeFormatter.ISO_LOCAL_DATE_TIME
HandlerMethodArgumentResolver
that can resolve the current Environment
, Site
and
Application
.Modifier and Type | Class and Description |
---|---|
static class |
RestConfig.SiteAwareHandlerMethodArgumentResolver
|
Constructor and Description |
---|
RestConfig() |
Modifier and Type | Method and Description |
---|---|
protected void |
addDateModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper) |
org.springframework.http.converter.ByteArrayHttpMessageConverter |
byteArrayHttpMessageConverter() |
static List<org.springframework.web.method.support.HandlerMethodArgumentResolver> |
getArgumentResolvers(org.springframework.context.ApplicationContext context) |
protected <T extends Temporal> |
getDateModule(Class<T> temporal,
Function<String,T> parseFunction,
DateTimeFormatter formatter) |
static List<org.springframework.http.converter.HttpMessageConverter<?>> |
getMessageConverters(org.springframework.context.ApplicationContext context) |
protected <T> T |
getPrimaryOrFirst(Map<String,T> beans,
Map<String,Object> primaryBeans) |
void |
postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) |
RestConfig.SiteAwareHandlerMethodArgumentResolver |
siteAwareHandlerMethodArgumentResolver(Site site,
Application application,
Environment environment) |
public static List<org.springframework.http.converter.HttpMessageConverter<?>> getMessageConverters(org.springframework.context.ApplicationContext context)
public static List<org.springframework.web.method.support.HandlerMethodArgumentResolver> getArgumentResolvers(org.springframework.context.ApplicationContext context)
public void postProcessBeanFactory(org.springframework.beans.factory.config.ConfigurableListableBeanFactory beanFactory) throws org.springframework.beans.BeansException
postProcessBeanFactory
in interface org.springframework.beans.factory.config.BeanFactoryPostProcessor
org.springframework.beans.BeansException
protected <T> T getPrimaryOrFirst(Map<String,T> beans, Map<String,Object> primaryBeans)
protected void addDateModules(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
protected <T extends Temporal> com.fasterxml.jackson.databind.module.SimpleModule getDateModule(Class<T> temporal, Function<String,T> parseFunction, DateTimeFormatter formatter)
@Bean public org.springframework.http.converter.ByteArrayHttpMessageConverter byteArrayHttpMessageConverter()
@Bean @Lazy @RequestScope(proxyMode=NO) public RestConfig.SiteAwareHandlerMethodArgumentResolver siteAwareHandlerMethodArgumentResolver(Site site, Application application, Environment environment)
Copyright © 2011–2023 aiticon GmbH. All rights reserved.