commit
5cd2c3b5eb
@ -1,9 +1,11 @@
|
|||||||
package org.baeldung.spring;
|
package org.baeldung.spring;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.ImportResource;
|
import org.springframework.context.annotation.ImportResource;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
|
@EnableAutoConfiguration
|
||||||
@ImportResource({ "classpath:webSecurityConfig.xml" })
|
@ImportResource({ "classpath:webSecurityConfig.xml" })
|
||||||
public class SecSecurityConfig {
|
public class SecSecurityConfig {
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@ import javax.servlet.http.HttpServletResponse;
|
|||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class MetricFilter implements Filter {
|
public class MetricFilter implements Filter {
|
||||||
@ -23,6 +24,10 @@ public class MetricFilter implements Filter {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(final FilterConfig config) throws ServletException {
|
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
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user