File tree Expand file tree Collapse file tree 2 files changed +53
-1
lines changed
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/web
spring-boot/src/main/java/org/springframework/boot/context/web Expand file tree Collapse file tree 2 files changed +53
-1
lines changed Original file line number Diff line number Diff line change 3939import org .springframework .boot .autoconfigure .condition .ConditionalOnProperty ;
4040import org .springframework .boot .autoconfigure .condition .ConditionalOnWebApplication ;
4141import org .springframework .boot .context .properties .EnableConfigurationProperties ;
42+ import org .springframework .boot .context .web .OrderedHiddenHttpMethodFilter ;
4243import org .springframework .context .ResourceLoaderAware ;
4344import org .springframework .context .annotation .Bean ;
4445import org .springframework .context .annotation .Configuration ;
@@ -127,7 +128,7 @@ public class WebMvcAutoConfiguration {
127128 @ Bean
128129 @ ConditionalOnMissingBean (HiddenHttpMethodFilter .class )
129130 public HiddenHttpMethodFilter hiddenHttpMethodFilter () {
130- return new HiddenHttpMethodFilter ();
131+ return new OrderedHiddenHttpMethodFilter ();
131132 }
132133
133134 // Defined as a nested config to ensure WebMvcConfigurerAdapter is not read when not
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright 2012-2015 the original author or authors.
3+ *
4+ * Licensed under the Apache License, Version 2.0 (the "License");
5+ * you may not use this file except in compliance with the License.
6+ * You may obtain a copy of the License at
7+ *
8+ * http://www.apache.org/licenses/LICENSE-2.0
9+ *
10+ * Unless required by applicable law or agreed to in writing, software
11+ * distributed under the License is distributed on an "AS IS" BASIS,
12+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+ * See the License for the specific language governing permissions and
14+ * limitations under the License.
15+ */
16+
17+ package org .springframework .boot .context .web ;
18+
19+ import org .springframework .core .Ordered ;
20+ import org .springframework .web .filter .HiddenHttpMethodFilter ;
21+
22+ /**
23+ * {@link HiddenHttpMethodFilter} that also implements {@link Ordered}.
24+ *
25+ * @author Phillip Webb
26+ * @since 1.2.4
27+ */
28+ public class OrderedHiddenHttpMethodFilter extends HiddenHttpMethodFilter implements
29+ Ordered {
30+
31+ /**
32+ * The default order is high to ensure the filter is applied before Spring Security.
33+ */
34+ public static final int DEFAULT_ORDER = Ordered .HIGHEST_PRECEDENCE + 10 ;
35+
36+ private int order = DEFAULT_ORDER ;
37+
38+ @ Override
39+ public int getOrder () {
40+ return this .order ;
41+ }
42+
43+ /**
44+ * Set the order for this filter.
45+ * @param order the order to set
46+ */
47+ public void setOrder (int order ) {
48+ this .order = order ;
49+ }
50+
51+ }
You can’t perform that action at this time.
0 commit comments