File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
spring-security-rest-full/src/main/java/org/baeldung Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change 11package org .baeldung .spring ;
22
3+ import org .springframework .boot .autoconfigure .EnableAutoConfiguration ;
34import org .springframework .context .annotation .Configuration ;
45import org .springframework .context .annotation .ImportResource ;
56
67@ Configuration
8+ @ EnableAutoConfiguration
79@ ImportResource ({ "classpath:webSecurityConfig.xml" })
810public class SecSecurityConfig {
911
Original file line number Diff line number Diff line change 1111
1212import org .springframework .beans .factory .annotation .Autowired ;
1313import org .springframework .stereotype .Component ;
14+ import org .springframework .web .context .support .WebApplicationContextUtils ;
1415
1516@ Component
1617public class MetricFilter implements Filter {
@@ -23,6 +24,10 @@ public class MetricFilter implements Filter {
2324
2425 @ Override
2526 public void init (final FilterConfig config ) throws ServletException {
27+ if (metricService == null || actMetricService == null ) {
28+ metricService = (IMetricService ) WebApplicationContextUtils .getRequiredWebApplicationContext (config .getServletContext ()).getBean ("metricService" );
29+ actMetricService = (IActuatorMetricService ) WebApplicationContextUtils .getRequiredWebApplicationContext (config .getServletContext ()).getBean ("actuatorMetricService" );
30+ }
2631 }
2732
2833 @ Override
You can’t perform that action at this time.
0 commit comments