File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
tang-framework/src/main/java/com/tang/framework/config Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .tang .framework .config ;
2
+
3
+ import java .util .EnumSet ;
4
+
5
+ import org .springframework .boot .web .servlet .FilterRegistrationBean ;
6
+ import org .springframework .context .annotation .Bean ;
7
+ import org .springframework .context .annotation .Configuration ;
8
+ import org .springframework .core .Ordered ;
9
+ import org .springframework .web .servlet .handler .HandlerMappingIntrospector ;
10
+
11
+ import jakarta .servlet .DispatcherType ;
12
+ import jakarta .servlet .Filter ;
13
+
14
+ /**
15
+ * 缓存 HandlerMappingIntrospector
16
+ *
17
+ * @author Tang
18
+ */
19
+ @ Configuration
20
+ public class CacheHandlerMappingIntrospectorConfig {
21
+
22
+ @ Bean
23
+ static FilterRegistrationBean <Filter > handlerMappingIntrospectorCacheFilter (HandlerMappingIntrospector handlerMappingIntrospector ) {
24
+ var cacheFilter = handlerMappingIntrospector .createCacheFilter ();
25
+ var registrationBean = new FilterRegistrationBean <>(cacheFilter );
26
+ registrationBean .setOrder (Ordered .HIGHEST_PRECEDENCE );
27
+ registrationBean .setDispatcherTypes (EnumSet .allOf (DispatcherType .class ));
28
+ return registrationBean ;
29
+ }
30
+
31
+ }
You can’t perform that action at this time.
0 commit comments