Example usage for org.springframework.web.context.support ServletContextAttributeExporter setAttributes

List of usage examples for org.springframework.web.context.support ServletContextAttributeExporter setAttributes

Introduction

In this page you can find the example usage for org.springframework.web.context.support ServletContextAttributeExporter setAttributes.

Prototype

public void setAttributes(Map<String, Object> attributes) 

Source Link

Document

Set the ServletContext attributes to expose as key-value pairs.

Usage

From source file:org.ezand.telldus.rest.config.SwaggerConfig.java

@Autowired
@Bean/*from  w ww  .ja  v a2s  .c om*/
public ServletContextAttributeExporter contextAttributes(final SwaggerSettings settings) {
    final Map<String, Object> attributes = newHashMap();
    attributes.put("swagger",
            new Swagger().info(new Info().title(settings.getTitle())
                    .contact(new Contact().email(settings.getContact())).license(new License()
                            .name(settings.getLicense().getTitle()).url(settings.getLicense().getUrl()))
                    .description(settings.getDescription())));

    final ServletContextAttributeExporter exporter = new ServletContextAttributeExporter();
    exporter.setAttributes(attributes);
    return exporter;
}

From source file:org.haiku.haikudepotserver.config.AppConfig.java

@Bean
public ServletContextAttributeExporter servletContextAttributeExporter(MetricRegistry metricRegistry,
        HealthCheckRegistry healthCheckRegistry) {
    ServletContextAttributeExporter exporter = new ServletContextAttributeExporter();
    exporter.setAttributes(ImmutableMap.of("com.codahale.metrics.servlets.MetricsServlet.registry",
            metricRegistry, "com.codahale.metrics.servlets.HealthCheckServlet.registry", healthCheckRegistry));
    return exporter;
}