fix boot configurations

This commit is contained in:
DOHA 2015-03-30 13:30:00 +02:00
parent fb3645d1e8
commit d425484570
2 changed files with 7 additions and 0 deletions

View File

@ -1,9 +1,11 @@
package org.baeldung.spring;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@Configuration
@EnableAutoConfiguration
@ImportResource({ "classpath:webSecurityConfig.xml" })
public class SecSecurityConfig {

View File

@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.context.support.WebApplicationContextUtils;
@Component
public class MetricFilter implements Filter {
@ -23,6 +24,10 @@ public class MetricFilter implements Filter {
@Override
public void init(final FilterConfig config) throws ServletException {
if (metricService == null || actMetricService == null) {
metricService = (IMetricService) WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()).getBean("metricService");
actMetricService = (IActuatorMetricService) WebApplicationContextUtils.getRequiredWebApplicationContext(config.getServletContext()).getBean("actuatorMetricService");
}
}
@Override