Prevent ErrorPageFilter from being used if SBServletInitializer is used
Previously, the configuration class that produces the ErrorPageFilter bean was an inner class of SpringBootServletInitializer. As a result, whenever SpringBootServletInitializer was subclasses, the ErrorPageFilter would be used. This adversely affected applications running as an executable war file and those deployed to a container with error page filter registration disabled. This commit makes ErrorPageFilterConfiguration a top-level class so that it is no longer always found via SpringBootServletInitializer. The test that verifies that error page filter registration can be disabled has been updated to more accurately simulate the behaviour when an application is deployed as a war to a standalone container. A test that mimics the behaviour of an application run as an executable war has also been added. Closes gh-8477pull/8516/head
parent
d74af04724
commit
6381a07c71
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.boot.web.support;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Configuration for {@link ErrorPageFilter}.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@Configuration
|
||||
class ErrorPageFilterConfiguration {
|
||||
|
||||
@Bean
|
||||
public ErrorPageFilter errorPageFilter() {
|
||||
return new ErrorPageFilter();
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue