Example usage for org.springframework.boot.autoconfigure.web.reactive.error DefaultErrorWebExceptionHandler DefaultErrorWebExceptionHandler

List of usage examples for org.springframework.boot.autoconfigure.web.reactive.error DefaultErrorWebExceptionHandler DefaultErrorWebExceptionHandler

Introduction

In this page you can find the example usage for org.springframework.boot.autoconfigure.web.reactive.error DefaultErrorWebExceptionHandler DefaultErrorWebExceptionHandler.

Prototype

public DefaultErrorWebExceptionHandler(ErrorAttributes errorAttributes, ResourceProperties resourceProperties,
        ErrorProperties errorProperties, ApplicationContext applicationContext) 

Source Link

Document

Create a new DefaultErrorWebExceptionHandler instance.

Usage

From source file:org.springframework.cloud.function.web.function.FunctionEndpointInitializer.java

private DefaultErrorWebExceptionHandler errorHandler(GenericApplicationContext context) {
    context.registerBean(ErrorAttributes.class, () -> new DefaultErrorAttributes());
    context.registerBean(ErrorProperties.class, () -> new ErrorProperties());
    context.registerBean(ResourceProperties.class, () -> new ResourceProperties());
    DefaultErrorWebExceptionHandler handler = new DefaultErrorWebExceptionHandler(
            context.getBean(ErrorAttributes.class), context.getBean(ResourceProperties.class),
            context.getBean(ErrorProperties.class), context);
    ServerCodecConfigurer codecs = ServerCodecConfigurer.create();
    handler.setMessageWriters(codecs.getWriters());
    handler.setMessageReaders(codecs.getReaders());
    return handler;
}