Merge pull request #179 from Doha2012/master

fix boot configurations
This commit is contained in:
Eugen 2015-03-30 14:58:40 +03:00
commit 5cd2c3b5eb
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