All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.edgarespina.mwa.WebDefaults Maven / Gradle / Ivy

package com.github.edgarespina.mwa;

import org.codehaus.jackson.map.ObjectMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * Apply sensible defaults Spring MVC options, like:
 * 
    *
  • Enable default servlet. *
  • Get HandlerExceptionResolver from the Spring Application Context. *
* * @author edgar.espina * @since 0.1 */ @Configuration class WebDefaults extends WebMvcConfigurationSupport { /** * The default object mapper name. */ public static final String OBJECT_MAPPER = "globalObjectMapper"; /** * Enable the default servlet. {@inheritDoc} */ @Override public void configureDefaultServletHandling( final DefaultServletHandlerConfigurer configurer) { configurer.enable(); } /** * Publish a new object mapper. * * @return A new object mapper. */ @Bean(name = OBJECT_MAPPER) public ObjectMapper globalObjectMapper() { return new ObjectMapper(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy