Java Code Examples for org.springframework.web.servlet.handler.HandlerExceptionResolverComposite#setOrder()

The following examples show how to use org.springframework.web.servlet.handler.HandlerExceptionResolverComposite#setOrder() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebMvcConfigurationSupport.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Returns a {@link HandlerExceptionResolverComposite} containing a list of exception
 * resolvers obtained either through {@link #configureHandlerExceptionResolvers} or
 * through {@link #addDefaultHandlerExceptionResolvers}.
 * <p><strong>Note:</strong> This method cannot be made final due to CGLIB constraints.
 * Rather than overriding it, consider overriding {@link #configureHandlerExceptionResolvers}
 * which allows for providing a list of resolvers.
 */
@Bean
public HandlerExceptionResolver handlerExceptionResolver(
		ContentNegotiationManager mvcContentNegotiationManager) {
	List<HandlerExceptionResolver> exceptionResolvers = new ArrayList<>();
	configureHandlerExceptionResolvers(exceptionResolvers);
	if (exceptionResolvers.isEmpty()) {
		addDefaultHandlerExceptionResolvers(exceptionResolvers, mvcContentNegotiationManager);
	}
	extendHandlerExceptionResolvers(exceptionResolvers);
	HandlerExceptionResolverComposite composite = new HandlerExceptionResolverComposite();
	composite.setOrder(0);
	composite.setExceptionResolvers(exceptionResolvers);
	return composite;
}
 
Example 2
Source File: WebMvcConfigurationSupport.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Returns a {@link HandlerExceptionResolverComposite} containing a list of exception
 * resolvers obtained either through {@link #configureHandlerExceptionResolvers} or
 * through {@link #addDefaultHandlerExceptionResolvers}.
 * <p><strong>Note:</strong> This method cannot be made final due to CGLIB constraints.
 * Rather than overriding it, consider overriding {@link #configureHandlerExceptionResolvers}
 * which allows for providing a list of resolvers.
 */
@Bean
public HandlerExceptionResolver handlerExceptionResolver() {
	List<HandlerExceptionResolver> exceptionResolvers = new ArrayList<>();
	configureHandlerExceptionResolvers(exceptionResolvers);
	if (exceptionResolvers.isEmpty()) {
		addDefaultHandlerExceptionResolvers(exceptionResolvers);
	}
	extendHandlerExceptionResolvers(exceptionResolvers);
	HandlerExceptionResolverComposite composite = new HandlerExceptionResolverComposite();
	composite.setOrder(0);
	composite.setExceptionResolvers(exceptionResolvers);
	return composite;
}
 
Example 3
Source File: WebMvcConfigurationSupport.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns a {@link HandlerExceptionResolverComposite} containing a list
 * of exception resolvers obtained either through
 * {@link #configureHandlerExceptionResolvers(List)} or through
 * {@link #addDefaultHandlerExceptionResolvers(List)}.
 * <p><strong>Note:</strong> This method cannot be made final due to CGLib
 * constraints. Rather than overriding it, consider overriding
 * {@link #configureHandlerExceptionResolvers(List)}, which allows
 * providing a list of resolvers.
 */
@Bean
public HandlerExceptionResolver handlerExceptionResolver() {
	List<HandlerExceptionResolver> exceptionResolvers = new ArrayList<HandlerExceptionResolver>();
	configureHandlerExceptionResolvers(exceptionResolvers);
	if (exceptionResolvers.isEmpty()) {
		addDefaultHandlerExceptionResolvers(exceptionResolvers);
	}
	extendHandlerExceptionResolvers(exceptionResolvers);
	HandlerExceptionResolverComposite composite = new HandlerExceptionResolverComposite();
	composite.setOrder(0);
	composite.setExceptionResolvers(exceptionResolvers);
	return composite;
}
 
Example 4
Source File: WebMvcConfigurationSupport.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Returns a {@link HandlerExceptionResolverComposite} containing a list
 * of exception resolvers obtained either through
 * {@link #configureHandlerExceptionResolvers(List)} or through
 * {@link #addDefaultHandlerExceptionResolvers(List)}.
 * <p><strong>Note:</strong> This method cannot be made final due to CGLib
 * constraints. Rather than overriding it, consider overriding
 * {@link #configureHandlerExceptionResolvers(List)}, which allows
 * providing a list of resolvers.
 */
@Bean
public HandlerExceptionResolver handlerExceptionResolver() {
	List<HandlerExceptionResolver> exceptionResolvers = new ArrayList<HandlerExceptionResolver>();
	configureHandlerExceptionResolvers(exceptionResolvers);

	if (exceptionResolvers.isEmpty()) {
		addDefaultHandlerExceptionResolvers(exceptionResolvers);
	}

	HandlerExceptionResolverComposite composite = new HandlerExceptionResolverComposite();
	composite.setOrder(0);
	composite.setExceptionResolvers(exceptionResolvers);
	return composite;
}