Example usage for org.springframework.boot.web.servlet.context AnnotationConfigServletWebServerApplicationContext register

List of usage examples for org.springframework.boot.web.servlet.context AnnotationConfigServletWebServerApplicationContext register

Introduction

In this page you can find the example usage for org.springframework.boot.web.servlet.context AnnotationConfigServletWebServerApplicationContext register.

Prototype

@Override
public final void register(Class<?>... annotatedClasses) 

Source Link

Document

Register one or more annotated classes to be processed.

Usage

From source file:org.springframework.boot.actuate.autoconfigure.metrics.PublicMetricsAutoConfigurationTests.java

private void loadWeb(Class<?>... config) {
    AnnotationConfigServletWebServerApplicationContext context = new AnnotationConfigServletWebServerApplicationContext();
    if (config.length > 0) {
        context.register(config);
    }/* ww  w .j a v  a  2  s .  co m*/
    context.register(DataSourcePoolMetadataProvidersConfiguration.class, CacheStatisticsAutoConfiguration.class,
            PublicMetricsAutoConfiguration.class, MockServletWebServerFactory.class);
    context.refresh();
    this.context = context;
}