Skip to content

Commit 5cd2c3b

Browse files
author
Eugen
committed
Merge pull request eugenp#179 from Doha2012/master
fix boot configurations
2 parents 7fd1e58 + d425484 commit 5cd2c3b

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

spring-security-rest-full/src/main/java/org/baeldung/spring/SecSecurityConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package org.baeldung.spring;
22

3+
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
34
import org.springframework.context.annotation.Configuration;
45
import org.springframework.context.annotation.ImportResource;
56

67
@Configuration
8+
@EnableAutoConfiguration
79
@ImportResource({ "classpath:webSecurityConfig.xml" })
810
public class SecSecurityConfig {
911

spring-security-rest-full/src/main/java/org/baeldung/web/metric/MetricFilter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import org.springframework.beans.factory.annotation.Autowired;
1313
import org.springframework.stereotype.Component;
14+
import org.springframework.web.context.support.WebApplicationContextUtils;
1415

1516
@Component
1617
public 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

0 commit comments

Comments
 (0)