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

org.zodiac.autoconfigure.web.error.ServletErrorAutoConfiguration Maven / Gradle / Ivy

There is a newer version: 1.6.8
Show newest version
package org.zodiac.autoconfigure.web.error;

import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type;
import org.springframework.boot.web.servlet.error.ErrorAttributes;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.zodiac.autoconfigure.web.HttpContextProperties;
import org.zodiac.commons.constants.SystemPropertiesConstants;
import org.zodiac.core.web.error.CompositeErrorConfigurer;
import org.zodiac.core.web.servlet.ServletSmartErrorHandler;

@SpringBootConfiguration
@ConditionalOnWebApplication(type = Type.SERVLET)
@ConditionalOnClass(value = {freemarker.template.Template.class})
@ConditionalOnProperty(value = SystemPropertiesConstants.Zodiac.SPRING_HTTP_CONTEXT_ERROR_HANDLER_ENABLED, havingValue = "true")
public class ServletErrorAutoConfiguration extends AbstractErrorAutoConfiguration {

    public ServletErrorAutoConfiguration(ApplicationContext applicationContext,
        HttpContextProperties httpContextProperties) {
        super(applicationContext, httpContextProperties);
    }

    @Bean
    @ConditionalOnMissingBean
    public ServletSmartErrorHandler servletSmartErrorHandler(ErrorAttributes errorAttrs,
            CompositeErrorConfigurer compositeErrorConfigurer) {
        return new ServletSmartErrorHandler(errorAttrs, httpCommonErrorHandlerInfo, compositeErrorConfigurer);
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy